It looks like nothing was found at this location. Maybe try one of the links below or a search?
esired field style. * * @return bool */ protected function is_field_style( $form, $style ) { $is_field_style = false; if ( empty( $form['fields'] ) ) { return $is_field_style; } foreach ( (array) $form['fields'] as $field ) { if ( ! empty( $field['type'] ) && $field['type'] === $this->type && ! empty( $field['style'] ) && sanitize_key( $style ) === $field['style'] ) { $is_field_style = true; break; } } return $is_field_style; } /** * Get field name for an ajax error message. * * @since 1.8.2 * * @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. * * @return string * @noinspection PhpMissingReturnTypeInspection * @noinspection ReturnTypeCanBeDeclaredInspection */ public function ajax_error_field_name( $name, $field, $props, $error ) { $name = (string) $name; if ( ! isset( $field['type'] ) || $field['type'] !== $this->type ) { return $name; } return $props['input_container']['attr']['name'] ?? ''; } } ms-single-item-price ' . wpforms_sanitize_classes( $primary['class'], true ) . '">'; echo wp_kses( $field_label, [ 'span' => [ 'class' => [], ], ] ); echo ''; $this->display_quantity_dropdown( $field ); echo ''; } // Primary price field. printf( '', wpforms_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); break; case self::FORMAT_USER: printf( '', wpforms_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); break; default: break; } } /** * Validate field on form submit. * * @since 1.8.2 * * @param int $field_id Field ID. * @param string $field_submit Submitted field value (raw data). * @param array $form_data Form data and settings. */ public function validate( $field_id, $field_submit, $form_data ) { $is_required = ! empty( $form_data['fields'][ $field_id ]['required'] ); // If field is required, check for data. if ( empty( $field_submit ) && $is_required ) { wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ] = wpforms_get_required_label(); return; } /** * Whether to validate amount or not of the Payment Single item field. * * @since 1.8.4 * * @param bool $validate Whether to validate amount or not. Default true. * @param int $field_id Field ID. * @param string $field_submit Field data submitted by a user. * @param array $form_data Form data and settings. */ $validate_amount = apply_filters( 'wpforms_forms_fields_payment_single_field_validate_amount', true, $field_id, $field_submit, $form_data ); // If field format is not user provided, validate the amount posted. if ( ! empty( $field_submit ) && $validate_amount && ! $this->is_user_defined( $form_data['fields'][ $field_id ] ) ) { $price = wpforms_sanitize_amount( $form_data['fields'][ $field_id ]['price'] ); $submit = wpforms_sanitize_amount( $field_submit ); if ( $price !== $submit ) { wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Amount mismatch', 'wpforms-lite' ); } } // If field format is provided by user, additionally compare the amount with a minimum price. if ( ! empty( $field_submit ) && $validate_amount && $this->is_user_defined( $form_data['fields'][ $field_id ] ) ) { $submit = wpforms_sanitize_amount( $field_submit ); if ( $submit < 0 ) { wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Amount can\'t be negative' , 'wpforms-lite' ); } if ( empty( $form_data['fields'][ $field_id ]['min_price'] ) && ! $is_required ) { return; } $min_price = wpforms_sanitize_amount( $form_data['fields'][ $field_id ]['min_price'] ); if ( $submit < $min_price ) { wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Amount can\'t be less than the required minimum.' , 'wpforms-lite' ); } } } /** * Format and sanitize field. * * @since 1.8.2 * * @param int $field_id Field ID. * @param string $field_submit Field data submitted by a user. * @param array $form_data Form data and settings. */ public function format( $field_id, $field_submit, $form_data ) { $field = $form_data['fields'][ $field_id ]; $name = ! empty( $field['label'] ) ? sanitize_text_field( $field['label'] ) : ''; // Only trust the value if the field has the user defined format OR it is the entry preview. if ( $this->is_user_defined( $field ) || wpforms_is_ajax( 'wpforms_get_entry_preview' ) ) { $amount = wpforms_sanitize_amount( $field_submit ); } else { $amount = wpforms_sanitize_amount( $field['price'] ); } $field_data = [ 'name' => $name, 'value' => wpforms_format_amount( $amount, true ), 'amount' => wpforms_format_amount( $amount ), 'amount_raw' => $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()->obj( 'process' )->fields[ $field_id ] = $field_data; } /** * Display the minimum price description for the field. * * @since 1.8.6 * * @param array $field Field data and settings. * @param array $form_data Form data and settings. */ public function field_minimum_price_description( $field, $form_data ) { if ( ! $this->is_user_defined( $field ) || ! isset( $field['min_price'] ) || empty( (float) wpforms_sanitize_amount( $field['min_price'] ) ) ) { return; } $description = sprintf( /* translators: %1$s - Minimum Price value. */ __( 'Minimum Price: %1$s', 'wpforms-lite' ), wpforms_format_amount( wpforms_sanitize_amount( $field['min_price'] ), true ) ); printf( '
It looks like nothing was found at this location. Maybe try one of the links below or a search?