Divi_Helpers::extract_fields( $content_shortcode )
Extracting fields from the form shortcode
Parameters Parameters
- $content_shortcode
-
(Required)
Return Return
(array)
Source Source
File: src/integrations/divi/helpers/divi-helpers.php
public static function extract_fields( $content_shortcode ) { $fields = array(); $pattern = get_shortcode_regex( array( 'et_pb_contact_field' ) ); preg_match_all( "/$pattern/", $content_shortcode, $contact_fields, PREG_SET_ORDER ); if ( empty( $contact_fields ) ) { return $fields; } foreach ( $contact_fields as $contact_field ) { $contact_field_attrs = shortcode_parse_atts( $contact_field[3] ); $field_id = strtolower( self::array_get( $contact_field_attrs, 'field_id' ) ); $fields[] = array( 'field_title' => self::array_get( $contact_field_attrs, 'field_title', __( 'No title', 'uncanny-automator' ) ), 'field_type' => self::array_get( $contact_field_attrs, 'field_type', 'text' ), 'field_id' => $field_id, 'required_mark' => self::array_get( $contact_field_attrs, 'required_mark', 'on' ), ); } return $fields; }
Expand full source code Collapse full source code View on Github