: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$value = wpforms_format_amount( $amount, true );
if ( empty( $field_submit ) ) {
} elseif ( ! empty( $field['choices'][ $field_submit ]['label'] ) ) {
$choice_label = sanitize_text_field( $field['choices'][ $field_submit ]['label'] );
$value = $choice_label . ' - ' . $value;
'value_choice' => $choice_label,
'value_raw' => sanitize_text_field( $field_submit ),
'amount' => wpforms_format_amount( $amount ),
'currency' => wpforms_get_currency(),
'id' => absint( $field_id ),
'type' => sanitize_key( $this->type ),
if ( $this->is_payment_quantities_enabled( $field ) ) {
$field_data['quantity'] = $this->get_submitted_field_quantity( $field, $form_data );
wpforms()->get( 'process' )->fields[ $field_id ] = $field_data;
* Form frontend CSS enqueues.
* @param array $forms Forms on the current page.
public function enqueue_frontend_css( $forms ) {
$has_modern_select = false;
foreach ( $forms as $form ) {
if ( $this->is_field_style( $form, self::STYLE_MODERN ) ) {
$has_modern_select = true;
if ( $has_modern_select || wpforms()->get( 'frontend' )->assets_global() ) {
$min = wpforms_get_min_suffix();
WPFORMS_PLUGIN_URL . "assets/css/choices{$min}.css",
* Form frontend JS enqueues.
* @param array $forms Forms on the current page.
public function enqueue_frontend_js( $forms ) {
$has_modern_select = false;
foreach ( $forms as $form ) {
if ( $this->is_field_style( $form, self::STYLE_MODERN ) ) {
$has_modern_select = true;
if ( $has_modern_select || wpforms()->get( 'frontend' )->assets_global() ) {
$this->enqueue_choicesjs_once( $forms );
* Whether the provided form has a dropdown field with a specified style.
* @param array $form Form data.
* @param string $style Desired field style.
protected function is_field_style( $form, $style ) {
if ( empty( $form['fields'] ) ) {
foreach ( (array) $form['fields'] as $field ) {
! empty( $field['type'] ) &&
$field['type'] === $this->type &&
! empty( $field['style'] ) &&
sanitize_key( $style ) === $field['style']
* Get field name for an ajax error message.
* @param string|mixed $name Field name for error triggered.
* @param array $field Field settings.
* @param array $props List of properties.
* @param string|string[] $error Error message.
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
public function ajax_error_field_name( $name, $field, $props, $error ) {
if ( ! isset( $field['type'] ) || $field['type'] !== $this->type ) {
return $props['input_container']['attr']['name'] ?? '';