PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.11
Smart Grid-Layout Design for Contact Form 7 v4.11
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / admin / partials / helpers / cf7sg-pre-form-load.php

cf7sg-pre-form-load.php in Smart Grid-Layout Design for Contact Form 7 4.11, at admin/partials/helpers/cf7sg-pre-form-load.php

92 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 List of helpers for hooks fired prior to the form loading.
4 */
5 /*
6 Available replacement varaibles:
7 {$form_key} - unique form key.
8 {$form_key_slug} - unique form key slug for function names.
9 ($field_name) - unique field name.
10 ($field_name_slug) - unique field name slug for function names.
11 [dqt] - double quote for html attributes.
12 */
13 ?>
14 <li>
15 <a class="helper" data-cf72post="add_filter( 'cf7sg_pre_cf7_field_html', 'filter_pre_html', 10, 2);
16 function filter_pre_html($html, $cf7_key){
17 //the $html string to change
18 //the $cf7_key is a unique string key to identify your form, which you can find in your form table i nthe dashboard.
19 if('{$form_key}'==$cf7_key ){
20 $html = '<label></label>';
21 }
22 return $html;
23 }" href="javascript:void(0);"><?=__('Filter','cf7-grid-layout')?></a> <?=__('cf7 tag field pre-html.','cf7-grid-layout')?>
24 </li>
25 <li>
26 <a class="helper" data-cf72post="add_filter( 'cf7sg_post_cf7_field_html', 'filter_post_html', 10, 2);
27 function filter_post_html($html, $cf7_key){
28 //the $html string to change
29 //the $cf7_key is a unique string key to identify your form, which you can find in your form table i nthe dashboard.
30 if('{$form_key}'==$cf7_key ){
31 $html = '';
32 }
33 return $html;
34 }" href="javascript:void(0);"><?=__('Filter','cf7-grid-layout')?></a> <?=__('cf7 tag field post-html.','cf7-grid-layout')?>
35 </li>
36 <li>
37 <a class="helper" data-cf72post="add_filter( 'cf7sg_required_cf7_field_html', 'filter_required_html', 10, 2);
38 function filter_required_html($html, $cf7_key){
39 //the $html string to change
40 //the $cf7_key is a unique string key to identify your form, which you can find in your form table i nthe dashboard.
41 if('{$form_key}'==$cf7_key ){
42 $html = '<span>(required)</span>';
43 }
44 return $html;
45 }" href="javascript:void(0);"><?=__('Filter','cf7-grid-layout')?></a> <?=__('cf7 tag required-html.','cf7-grid-layout')?>
46 </li>
47 <li>
48 <a class="helper" data-cf72post="add_filter( 'cf7_smart_grid_form_id','form_wrapper_id',10,2);
49 function form_wrapper_id($css_id, $cf7_key){
50 // $css_id the css id for the html form wrapper.
51 //$cf7_key unique form key to identify your form, $cf7_id is its post_id.
52 if('{$form_key}'!==$cf7_key ){
53 $css_id = 'my-form';
54 }
55 return $css_id;
56 }" href="javascript:void(0);"><?=__('Filter','cf7-grid-layout')?></a> <?=__('the form wrapper css id.','cf7-grid-layout')?>
57 </li>
58 <li>
59 <a class="helper" data-cf72post="add_filter('cf7sg_include_hidden_form_fields', 'insert_hidden_cf7sg_{$form_key_slug}',10,2);
60 function prefill_cf7sg_{$form_key_slug}($hidden, $cf7_key){
61 if('{$form_key}' != $cf7_key) return $values;
62 //return an array of field-name=>value pairs.
63 $hidden_values = array(
64 'my-secret-field' => 'default value',
65 );
66 //you may retrieve a hidden field in the client side using javascript:
67 // $('input[name=[dqt]my-secret-field[dqt]]');
68 return array_merge($hidden, $hidden_values);
69 }" href="javascript:void(0);"><?=__('Insert','cf7-grid-layout')?></a> <?=__('hidden fields.','cf7-grid-layout')?>
70 </li>
71 <li>
72 <a class="helper" data-cf72post="add_filter('cf7sg_prefill_form_fields', 'prefill_cf7sg_{$form_key_slug}',10,2);
73 function prefill_cf7sg_{$form_key_slug}($values, $cf7_key){
74 if('{$form_key}' != $cf7_key) return $values;
75 //return an array of field-name=>value pairs.
76 //fields with multiple selections such as checkboxes and dropdown menu can take an array as a value.
77 $custom_values = array(
78 'your-name' => 'test name',
79 'select-type' => array('House', 'Office'),
80 );
81 return array_merge($values, $custom_values);
82 }" href="javascript:void(0);"><?=__('Prefill','cf7-grid-layout')?></a> <?=__('form fields.','cf7-grid-layout')?>
83 </li>
84 <li>
85 <a class="helper" data-cf72post="add_action('cf7sg_enqueue_custom_script-{{$form_key}', 'localize_{$form_key_slug}',10,2);
86 function localize_{$form_key_slug}($script_id){
87 //when you use a custom JavaScript file for your form, this action if fired when the plugin loads it.
88 //this allows you to localize your script should you need to.
89 wp_localize_script($script_id, 'customVar', array('data'=>array(1,2,3,4)));
90 }" href="javascript:void(0);"><?=__('Localize','cf7-grid-layout')?></a> <?=__('custom js script.','cf7-grid-layout')?>
91 </li>
92