true, 'strategy' => 'defer') // Defer loading in footer ); } } add_action('admin_enqueue_scripts', 'wpcf7dtx_enqueue_admin_assets'); //Enqueue styles/scripts for admin page /** * Create Tag Generators * * @return void */ function wpcf7dtx_add_tag_generators() { if (!class_exists('WPCF7_TagGenerator')) { return; } // Custom dynamic fields to add global $wpcf7_dynamic_fields_config; // Loop fields to add them $tag_generator = WPCF7_TagGenerator::get_instance(); foreach ($wpcf7_dynamic_fields_config as $id => $field) { $tag_generator->add($id, $field['title'], 'wpcf7dtx_tag_generator', array_merge(array('name-attr', 'dtx_pageload'), $field['options'])); } } add_action('wpcf7_admin_init', 'wpcf7dtx_add_tag_generators', 100); /** * Echo HTML for Dynamic Tag Generator * * @param WPCF7_ContactForm $contact_form * @param array $options * * @return void */ function wpcf7dtx_tag_generator($contact_form, $options = '') { $options = wp_parse_args($options); global $wpcf7_dynamic_fields_config; $type = $options['id']; $input_type = str_replace('dynamic_', '', $type); $utm_source = urlencode(home_url()); $description = sprintf( __('Generate a form-tag for %s with a dynamic default value. For more details, see %s fields in the %s.', 'contact-form-7-dynamic-text-extension'), esc_html($wpcf7_dynamic_fields_config[$type]['description']), // dynamic description // Link to specific form-tag documentation sprintf( '%s', esc_attr(str_replace('_', '-', $type)), // URL component esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_attr__('View this form-tag on the DTX Documentation website', 'contact-form-7-dynamic-text-extension'), // Link title esc_html(ucwords(str_replace('_', ' ', $type))) // Link label ), // Link to general DTX documentation sprintf( '%s', esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_attr__('Go to DTX Documentation website', 'contact-form-7-dynamic-text-extension'), esc_html__('DTX knowledge base', 'contact-form-7-dynamic-text-extension') ) ); // Open Form-Tag Generator printf( '
%s', wp_kses($description, array('a' => array('href' => array(), 'target' => array(), 'rel' => array(), 'title' => array()))) //Tag generator description ); // Input field - Required checkbox (not available for some fields) if (!in_array($input_type, array('hidden', 'quiz', 'submit', 'reset', 'label'))) { printf( '', esc_attr($options['content'] . '-required'), // field id esc_html__('Field type', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'required', 'id' => $options['content'] . '-required' )), esc_html__('Required field', 'contact-form-7-dynamic-text-extension') // checkbox label ); } // Input field - Field Name (not available for some fields) if (!in_array($input_type, array('submit', 'reset', 'label'))) { printf( '', esc_attr($options['content'] . '-name'), // field id esc_html__('Name', 'contact-form-7-dynamic-text-extension'), // field label wpcf7_format_atts(array( 'type' => 'text', 'name' => 'name', 'id' => $options['content'] . '-name', 'class' => 'tg-name oneline', 'autocomplete' => 'off' )) ); } // Input field - Dynamic value/options $value_name = __('Dynamic value', 'contact-form-7-dynamic-text-extension'); $value_description = __('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); $value_placeholder = "CF7_GET key='foo'"; $value_input_type = ''; switch ($input_type) { case 'textarea': $value_placeholder = "CF7_get_post_var key='post_excerpt'"; $value_input_type = ''; break; case 'select': $value_name = __('Dynamic options', 'contact-form-7-dynamic-text-extension'); $value_description .= ' ' . __('If static text, use one option per line. Can define static key/value pairs using pipes.', 'contact-form-7-dynamic-text-extension'); $value_description .= ' ' . __('If shortcode, it must return only option or optgroup HTML and can override the first option and select default settings here.', 'contact-form-7-dynamic-text-extension'); $value_placeholder = "hello-world | Hello World" . PHP_EOL . "Foo"; $value_input_type = ''; break; case 'checkbox': case 'radio': $value_name = __('Dynamic options', 'contact-form-7-dynamic-text-extension'); $value_description .= ' ' . __('If static text, use one option per line. Can define static key/value pairs using pipes.', 'contact-form-7-dynamic-text-extension'); $value_description .= ' ' . __('If shortcode, it must return only option or optgroup HTML.', 'contact-form-7-dynamic-text-extension'); $value_placeholder = "hello-world | Hello World" . PHP_EOL . "Foo"; $value_input_type = ''; break; default: // All other text fields break; } printf( '', esc_attr($options['content'] . '-values'), // field id esc_html($value_name), // field label wpcf7_format_atts(array( 'name' => 'values', 'id' => $options['content'] . '-values', 'class' => 'multiline', 'placeholder' => $value_placeholder, 'list' => 'dtx-shortcodes' )), esc_html($value_description), esc_attr($utm_source), // UTM source esc_attr($type), // UTM content esc_html__('View DTX shortcode syntax documentation', 'contact-form-7-dynamic-text-extension') // Link label ); if ($input_type == 'label') { $placeholder_description = __('The id attribute of the element this label is for.', 'contact-form-7-dynamic-text-extension'); $placeholder_description .= __('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); printf( '', esc_attr($options['content'] . '-for'), // field id esc_html__('For attribute'), // field label wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'for', 'class' => 'option' )), wpcf7_format_atts(array( 'name' => 'dtx-for', 'id' => $options['content'] . '-for', // field id 'class' => 'multiline dtx-option' )), esc_html($placeholder_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View documentation for Dynamic Attributes', 'contact-form-7-dynamic-text-extension') //Link label ); } elseif ($input_type == 'select') { // Input field - Multiple selections checkbox printf( '', esc_attr($options['content'] . '-multiple'), // field id esc_html__('Multiple Options', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'multiple', 'id' => $options['content'] . '-multiple', 'class' => 'option' )), esc_html__('Allow user to select multiple options', 'contact-form-7-dynamic-text-extension') // checkbox label ); // Input field - Include blank checkbox printf( '', esc_attr($options['content'] . '-include_blank'), // field id esc_html__('First Option', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'include_blank', 'id' => $options['content'] . '-include_blank', 'class' => 'include_blankvalue option' )), esc_html__('Insert a blank item as the first option', 'contact-form-7-dynamic-text-extension') // checkbox label ); } // Input field - Dynamic placeholder (not available for some fields) if (!in_array($input_type, array('hidden', 'radio', 'checkbox', 'range', 'quiz', 'submit', 'reset', 'label'))) { $placeholder_description = ''; if (in_array($input_type, array('select', 'checkbox', 'radio'))) { $placeholder_label = __('First Option Label', 'contact-form-7-dynamic-text-extension'); $placeholder_description .= __('Optionally define a label for the first option.', 'contact-form-7-dynamic-text-extension') . ' '; } else { $placeholder_label = __('Dynamic placeholder', 'contact-form-7-dynamic-text-extension'); } $placeholder_description .= __('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); $placeholder_input_type = $input_type == 'textarea' ? $value_input_type : ''; printf( '', esc_attr($options['content'] . '-placeholder'), // field id esc_html($placeholder_label), // field label wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'placeholder', 'class' => 'option' )), wpcf7_format_atts(array( 'name' => 'dtx-placeholder', 'id' => $options['content'] . '-placeholder', // field id 'class' => 'multiline dtx-option', 'placeholder' => "CF7_get_post_var key='post_title'", 'list' => 'dtx-shortcodes' )), esc_html($placeholder_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View DTX placeholder documentation', 'contact-form-7-dynamic-text-extension') //Link label ); } // Additional fields for select regarding placeholder options if ($input_type == 'select') { // Input field - Hide Blank Option printf( '', esc_attr($options['content'] . '-dtx_hide_blank'), // field id esc_html__('Hide First Option', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'dtx_hide_blank', 'id' => $options['content'] . '-dtx_hide_blank', 'class' => 'option' )), esc_html__('Hide the first blank option from being visible in the drop-down', 'contact-form-7-dynamic-text-extension'), // checkbox label esc_html__('Optional. Only works if "First Option" is checked.', 'contact-form-7-dynamic-text-extension'), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View Dynamic Select documentation', 'contact-form-7-dynamic-text-extension') //Link label ); // Input field - Disable Blank Option printf( '', esc_attr($options['content'] . '-dtx_disable_blank'), // field id esc_html__('Disable First Option', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'dtx_disable_blank', 'id' => $options['content'] . '-dtx_disable_blank', 'class' => 'option' )), esc_html__('Disable the first blank option from being selectable in the drop-down', 'contact-form-7-dynamic-text-extension'), // checkbox label esc_html__('Optional. Only works if "First Option" is checked.', 'contact-form-7-dynamic-text-extension'), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View Dynamic Select documentation', 'contact-form-7-dynamic-text-extension') //Link label ); } elseif (in_array($input_type, array('checkbox', 'radio'))) { // Additional fields for checkboxes and radio buttons // Input field - Checkbox Layout Reverse Option printf( '', esc_attr($options['content'] . '-label_first'), // field id esc_html__('Reverse', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'label_first', 'id' => $options['content'] . '-label_first', 'class' => 'option' )), esc_html__('Put a label first, an input last', 'contact-form-7-dynamic-text-extension') // checkbox label ); // Input field - Label UI printf( '', esc_attr($options['content'] . '-use_label_element'), // field id esc_html__('Label', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'use_label_element', 'id' => $options['content'] . '-use_label_element', 'class' => 'option' )), esc_html__('Wrap each item with label element', 'contact-form-7-dynamic-text-extension') // checkbox label ); // Input field - Exclusive Checkbox if ($input_type == 'checkbox') { printf( '', esc_attr($options['content'] . '-exclusive'), // field id esc_html__('Exclusive', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'exclusive', 'id' => $options['content'] . '-exclusive', 'class' => 'option' )), esc_html__('Make checkboxes exclusive', 'contact-form-7-dynamic-text-extension') // checkbox label ); } } // Input field - Dynamic default value (only available for selection-based fields) if (in_array($input_type, array('select', 'checkbox', 'radio'))) { $default_input_type = ''; $default_placeholder = ''; if ($input_type == 'checkbox') { //$default_input_type = ''; $default_description = __('Optionally define which checkboxes are checked by default by defining the checked values using an underscore (_) delimited list.', 'contact-form-7-dynamic-text-extension') . ' '; $default_placeholder = 'hello-world_Foo'; } else { $default_description = __('Optionally define the option that is selected by default. This can be different than the first [blank] option. If options use key/value pairs, only define the key here.', 'contact-form-7-dynamic-text-extension') . ' '; } $default_description .= __('Can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); printf( '', esc_attr($options['content'] . '-default'), // field id esc_html__('Selected Default'), // field label wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'default', 'class' => 'option' )), wpcf7_format_atts(array( 'name' => 'dtx-default', 'id' => $options['content'] . '-default', // field id 'class' => 'oneline dtx-option', 'placeholder' => $default_placeholder, 'list' => 'dtx-shortcodes' )), esc_html($default_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View Dynamic Select documentation', 'contact-form-7-dynamic-text-extension') //Link label ); } // Input field - Range attributes (only available for numeric and date fields) if (in_array($input_type, array('number', 'range', 'date'))) { $default_input_type = 'number'; $default_placeholder = 'Foo'; $step_option = ''; if ($input_type == 'date') { $default_input_type = 'date'; $default_description = __('Optionally define the minimum and/or maximum date values.', 'contact-form-7-dynamic-text-extension') . ' '; $default_placeholder = 'hello-world_Foo'; } else { $step_option = sprintf( '  ', esc_attr($options['content'] . '-step'), esc_html__('Step', 'contact-form-7-dynamic-text-extension'), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'step', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-step', 'id' => $options['content'] . '-step', 'class' => 'dtx-option', 'size' => 7 )) ); $default_description = __('Optionally define the minimum, maximum, and/or step values.', 'contact-form-7-dynamic-text-extension') . ' '; } $default_description .= __('Each can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); printf( '', esc_html__('Range', 'contact-form-7-dynamic-text-extension'), // field label esc_attr($options['content'] . '-min'), esc_html__('Min', 'contact-form-7-dynamic-text-extension'), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'min', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-min', 'id' => $options['content'] . '-min', 'class' => 'dtx-option', 'size' => 7 )), esc_attr($options['content'] . '-max'), esc_html__('Max', 'contact-form-7-dynamic-text-extension'), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'max', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-max', 'id' => $options['content'] . '-max', 'class' => 'dtx-option', 'size' => 7 )), $step_option, // Optional "step" option for numbers and ranges esc_html($default_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View documentation for Dynamic Attributes', 'contact-form-7-dynamic-text-extension') //Link label ); } //Input field - ID attribute printf( '', esc_attr($options['content'] . '-id'), // field id esc_html__('Id attribute', 'contact-form-7-dynamic-text-extension'), // field label wpcf7_format_atts(array( 'type' => 'text', 'name' => 'id', 'id' => $options['content'] . '-id', // field id 'class' => 'idvalue oneline option' )) ); //Input field - Class attribute printf( '', esc_attr($options['content'] . '-class'), // field id esc_html__('Class attribute', 'contact-form-7-dynamic-text-extension'), // field label wpcf7_format_atts(array( 'type' => 'text', 'name' => 'class', 'id' => $options['content'] . '-class', // field id 'class' => 'classvalue oneline option' )) ); // Input field - Maxlenth & Minlength attributes (only available for visible text fields) if (!in_array($input_type, array('hidden', 'quiz', 'submit', 'reset', 'label', 'number', 'range', 'date', 'select', 'checkbox', 'radio'))) { $default_description = __('Optionally define the minimum and/or maximum character string length. Must be a positive whole number or integer.', 'contact-form-7-dynamic-text-extension') . ' '; $default_description .= __('Each can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); printf( '', //esc_attr($options['content'] . '-default'), // field id esc_html__('Character Length', 'contact-form-7-dynamic-text-extension'), // field label esc_attr($options['content'] . '-minlength'), esc_html__('Min', 'contact-form-7-dynamic-text-extension'), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'minlength', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-minlength', 'id' => $options['content'] . '-minlength', 'class' => 'dtx-option', 'size' => 10 )), esc_attr($options['content'] . '-maxlength'), esc_html__('Max', 'contact-form-7-dynamic-text-extension'), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'maxlength', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-maxlength', 'id' => $options['content'] . '-maxlength', 'class' => 'dtx-option', 'size' => 10 )), esc_html($default_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View documentation for Dynamic Attributes', 'contact-form-7-dynamic-text-extension') //Link label ); } // Input field - Maxlenth & Minlength attributes (only available for visible text fields) if (in_array($input_type, array('text', 'email', 'phone', 'url', 'password', 'textarea'))) { $default_description = __('Optionally define an autocomplete setting by the browser.', 'contact-form-7-dynamic-text-extension') . ' '; $default_description .= __('Each can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); $datalist = array( 'off' => __('Off', 'contact-form-7-dynamic-text-extension'), 'on' => __('On', 'contact-form-7-dynamic-text-extension'), 'name' => __('Full Name', 'contact-form-7-dynamic-text-extension'), 'given-name' => __('First Name', 'contact-form-7-dynamic-text-extension'), 'family-name' => __('Last Name', 'contact-form-7-dynamic-text-extension'), 'honorific-prefix' => __('Honorific prefix or title', 'contact-form-7-dynamic-text-extension'), 'honorific-suffix' => __('Honorific suffix or credentials', 'contact-form-7-dynamic-text-extension'), 'nickname' => __('Nickname', 'contact-form-7-dynamic-text-extension'), 'email' => __('Email Address', 'contact-form-7-dynamic-text-extension'), 'new-password' => __('A new password', 'contact-form-7-dynamic-text-extension'), 'current-password' => __('The current password', 'contact-form-7-dynamic-text-extension'), 'organization-title' => __('Job Title', 'contact-form-7-dynamic-text-extension'), 'organization' => __('Company/Organization Name', 'contact-form-7-dynamic-text-extension'), 'street-address' => __('Full Street Address', 'contact-form-7-dynamic-text-extension'), 'shipping' => __('Full Shipping Address', 'contact-form-7-dynamic-text-extension'), 'billing' => __('Full Billing Address', 'contact-form-7-dynamic-text-extension'), 'address-line1' => __('Address Line 1', 'contact-form-7-dynamic-text-extension'), 'address-line2' => __('Address Line 2', 'contact-form-7-dynamic-text-extension'), 'address-line3' => __('Address Line 3', 'contact-form-7-dynamic-text-extension'), 'address-level1' => __('State', 'contact-form-7-dynamic-text-extension'), 'address-level2' => __('City', 'contact-form-7-dynamic-text-extension'), 'country' => __('Country', 'contact-form-7-dynamic-text-extension'), 'postal-code' => __('Zip Code', 'contact-form-7-dynamic-text-extension'), 'sex' => __('Gender Identity', 'contact-form-7-dynamic-text-extension'), 'tel' => __('Phone Number', 'contact-form-7-dynamic-text-extension'), 'tel-country-code' => __('Country Code', 'contact-form-7-dynamic-text-extension'), 'tel-national' => __('Full phone number without the country code', 'contact-form-7-dynamic-text-extension'), 'tel-area-code' => __('Area code, with country code if applicable', 'contact-form-7-dynamic-text-extension'), 'tel-local' => __('Phone number without the country code or area code', 'contact-form-7-dynamic-text-extension'), 'tel-local-prefix' => __('First part of the local phone number', 'contact-form-7-dynamic-text-extension'), 'tel-local-suffix' => __('Last part of the local phone number', 'contact-form-7-dynamic-text-extension'), 'url' => __('Website URL', 'contact-form-7-dynamic-text-extension'), 'webauthn' => __('Passkeys generated by the Web Authentication API', 'contact-form-7-dynamic-text-extension') ); $datalist_html = wpcf7dtx_options_html($datalist); printf( '', esc_attr($options['content'] . '-autocomplete'), // field id esc_html__('Auto-complete', 'contact-form-7-dynamic-text-extension'), // field label wp_kses($datalist_html, array('datalist' => array('id' => array()), 'option' => array('value' => array()))), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'autocomplete', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-autocomplete', 'id' => $options['content'] . '-autocomplete', 'class' => 'oneline dtx-option', 'list' => 'dtx-autocomplete-datalist' )), esc_html($default_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View documentation for Dynamic Attributes', 'contact-form-7-dynamic-text-extension') //Link label ); } //Input field - Autocapitalize attribute (only available for some fields) if (in_array($input_type, array('text', 'textarea'))) { $default_description = __('Optionally define an autocapitalize attribute for input when entered via non-typing mechanisms such as virtual keyboards on mobile devices or voice-to-text.', 'contact-form-7-dynamic-text-extension') . ' '; $default_description .= __('Each can be static text or a shortcode.', 'contact-form-7-dynamic-text-extension'); $datalist = array( 'none' => __('Do not automatically capitlize any text', 'contact-form-7-dynamic-text-extension'), 'off' => __('Do not automatically capitlize any text', 'contact-form-7-dynamic-text-extension'), 'on' => __('Automatically capitalize the first character of each sentence', 'contact-form-7-dynamic-text-extension'), 'sentences' => __('Automatically capitalize the first character of each sentence', 'contact-form-7-dynamic-text-extension'), 'words' => __('Automatically capitalize the first character of each word', 'contact-form-7-dynamic-text-extension'), 'characters' => __('Automatically capitalize every character', 'contact-form-7-dynamic-text-extension'), ); $datalist_html = wpcf7dtx_options_html($datalist); printf( '', esc_attr($options['content'] . '-autocapitalize'), // field id esc_html__('Auto-capitalize'), // field label wp_kses($datalist_html, array('datalist' => array('id' => array()), 'option' => array('value' => array()))), wpcf7_format_atts(array( 'type' => 'hidden', 'name' => 'autocapitalize', 'class' => 'option' )), wpcf7_format_atts(array( 'type' => 'text', 'name' => 'dtx-autocapitalize', 'id' => $options['content'] . '-autocapitalize', // field id 'class' => 'oneline dtx-option', 'list' => 'dtx-autocapitalize-datalist' )), esc_html($default_description), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View documentation for Dynamic Attributes', 'contact-form-7-dynamic-text-extension') //Link label ); } //Input field - Readonly attribute (not available for hidden, submit, or quiz fields) if (!in_array($input_type, array('hidden', 'submit', 'label', 'quiz', 'select'))) { printf( '', esc_attr($options['content'] . '-readonly'), // field id esc_html__('Read only attribute', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'readonly', 'id' => $options['content'] . '-readonly', 'class' => 'readonlyvalue option' )), esc_html__('Do not let users edit this field', 'contact-form-7-dynamic-text-extension') // checkbox label ); } //Input field - Disabled attribute (not available for hidden, submit, or quiz fields) // if (!in_array($input_type, array('hidden', 'submit', 'quiz'))) { // printf( // '', // esc_attr($options['content'] . '-disabled'), // field id // esc_html__('Disabled attribute', 'contact-form-7-dynamic-text-extension'), // field Label // wpcf7_format_atts(array( // 'type' => 'checkbox', // 'name' => 'disabled', // 'id' => $options['content'] . '-disabled', // 'class' => 'disabledvalue option' // )), // esc_html__('Prevent this data from sending on submit', 'contact-form-7-dynamic-text-extension') // checkbox label // ); // } //Input field - Autofocus attribute (not available for hidden, submit, or quiz fields) // if (!in_array($input_type, array('hidden', 'submit', 'quiz'))) { // printf( // '', // esc_attr($options['content'] . '-autofocus'), // field id // esc_html__('Autofocus attribute', 'contact-form-7-dynamic-text-extension'), // field Label // wpcf7_format_atts(array( // 'type' => 'checkbox', // 'name' => 'autofocus', // 'id' => $options['content'] . '-autofocus', // 'class' => 'autofocusvalue option' // )), // wp_kses_post('Automatically focus on this field Use careful consideration for accessibility.', 'contact-form-7-dynamic-text-extension') // checkbox label // ); // } // Input field - Page load data attribute (triggers the loading of a frontend script) printf( '', esc_attr($options['content'] . '-dtx_pageload'), // field id esc_html__('Cache Compatible', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'dtx_pageload', 'id' => $options['content'] . '-dtx_pageload', 'class' => 'option' )), esc_html__('Get the dynamic value after the page has loaded', 'contact-form-7-dynamic-text-extension'), // checkbox label esc_html__('May impact page performance.', 'contact-form-7-dynamic-text-extension'), // Small note below input esc_attr($utm_source), //UTM source esc_attr($type), //UTM content esc_html__('View DTX page load documentation', 'contact-form-7-dynamic-text-extension') //Link label ); // Input field - Akismet module (only available for text, email, and url fields) if (in_array($input_type, array('text', 'email', 'url'))) { switch ($input_type) { case 'email': $akismet_name = 'author_email'; $akismet_desc = __("This field requires author's email address", 'contact-form-7-dynamic-text-extension'); break; case 'url': $akismet_name = 'author_url'; $akismet_desc = __("This field requires author's URL", 'contact-form-7-dynamic-text-extension'); break; default: $akismet_name = 'author'; $akismet_desc = __("This field requires author's name", 'contact-form-7-dynamic-text-extension'); break; } printf( '', esc_attr($options['content'] . '-readonly'), // field id esc_html__('Akismet', 'contact-form-7-dynamic-text-extension'), // field Label wpcf7_format_atts(array( 'type' => 'checkbox', 'name' => 'akismet:' . $akismet_name, 'id' => $options['content'] . '-akismet-' . $akismet_name, 'class' => 'akismetvalue option' )), esc_html($akismet_desc) // checkbox label ); } //Close Form-Tag Generator if (in_array($input_type, array('hidden', 'submit', 'label', 'reset'))) { $demo_tag = ''; } else { $demo_tag = ''; } if (in_array($input_type, array('submit', 'reset', 'label'))) { $mail_description = esc_html('This value is not submitted in the contact form and should not be used in the mail template.', 'contact-form-7-dynamic-text-extension'); } else { $mail_description = sprintf( '', sprintf( esc_html__('To use the value input through this field in a mail field, you need to insert the corresponding mail-tag (%s) into the field on the Mail tab.', 'contact-form-7-dynamic-text-extension'), '' ) ); } printf( '
' . $value_input_type . '
%s %s

%s %s
' . $placeholder_input_type . '
%s %s

%s %s

%s %s
' . $default_input_type . '
%s %s
- %s
%s %s
-
%s %s
%s
%s %s
%s
%s %s

%s %s
' . $demo_tag . '

%s

', esc_attr($type), esc_html__('Insert Tag', 'contact-form-7-dynamic-text-extension'), $mail_description ); }