name ) ) { return ''; } $atts = array(); $class = wpcf7_form_controls_class( $tag->type ) . ' awooc-hidden-data'; $atts['class'] = apply_filters( 'awooc_class_hidden_field', $tag->get_class_option( $class ) ); $atts['id'] = $tag->get_id_option(); $value = (string) reset( $tag->values ); $value = $tag->get_default_option( $value ); $atts['value'] = $value; $atts['type'] = 'hidden'; $atts['name'] = $tag->name; $atts = wpcf7_format_atts( $atts ); $html = sprintf( '', sanitize_html_class( $tag->name ), $atts ); $html .= sprintf( '', 'awooc_product_id' ); $html .= sprintf( '', 'awooc_product_qty' ); return $html; } /** * @param WPCF7_Validation $result * @param WPCF7_FormTag $tag * * @return mixed */ function awooc_fields_validation_filter( $result, $tag ) { $name = $tag->name; // @codingStandardsIgnoreLine $value = isset( $_POST[ $name ] ) ? sanitize_text_field( $_POST[ $name ] ) : ''; if ( $tag->is_required() && '' === $value ) { $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); } return $result; } function awooc_fields_add_tag_generator_address() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'awooc_hidden', __( 'AWOOC hide field', 'art-woocommerce-order-one-click' ), 'awooc_tag_generator_hidden' ); } function awooc_tag_generator_hidden() { $type = 'awooc_hidden'; /* translators: %s: window description */ $description = __( 'Generate a special hidden multi-line field. See %s.', 'art-woocommerce-order-one-click' ); $desc_link = wpcf7_link( __( 'https://wpruse.ru/my-plugins/order-one-click/', 'art-woocommerce-order-one-click' ), __( 'the description for details', 'art-woocommerce-order-one-click' ) ); ?>