PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.1.1
Smart Grid-Layout Design for Contact Form 7 v4.1.1
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-js-events.php

cf7sg-js-events.php in Smart Grid-Layout Design for Contact Form 7 4.1.1, at admin/partials/helpers/cf7sg-js-events.php

247 lines 14.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * js event helper links for code snipets, displayed on the js codemirror tab.
4 * @since 4.0.0
5 */
6 ?>
7 <ul id="js-tags" class="display-none">
8 <li id="form-events" class="show-events"><?=__('Form','cf7-grid-layout')?><span>&gt;</span>
9 <ul>
10 <li><?= __('Event: ','cf7-grid-layout')?>
11 <a class="helper" data-cf72post="$('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'cf7SmartGridReady', function(e){
12 /* event fired once the form has been initialised, click to insert helper code into your js file. */
13 let $form = $(this); //$jquery form object.
14 });" href="javascript:void(0);"><?=__('form ready','cf7-grid-layout')?></a>
15 </li>
16 </ul>
17 </li>
18 <li id="table-events" class="display-none"><?=__('Tables','cf7-grid-layout')?><span>&gt;</span>
19 <ul>
20 <li><?= __('Event: ','cf7-grid-layout')?>
21 <a class="helper" data-cf72post="$('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgTableReady', '.container.cf7-sg-table', function(e){
22 /* event fired once a table has been initialised, click to insert helper code into your js file. */
23 let $form = $(e.delegateTarget), $table = $(e.target);
24 });" href="javascript:void(0);"><?=__('table ready','cf7-grid-layout')?></a>
25 </li>
26 <li><?= __('Event: ','cf7-grid-layout')?>
27 <a class="helper" data-cf72post="$('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgRowAdded', '.container.cf7-sg-table', function(e){
28 /* event fired when a table row has been added, click to insert helper code into your js file. */
29 //$form current form jquery object.
30 //$table table jquery object to which the new row was added.
31 //$row newly added row jquery object.
32 //rIdx row index (zero based).
33 let $form = $(e.delegateTarget), $table = $(e.target), rIdx = e['row'], $row= $table.find('.row[data-row='+rIdx+']');
34 });" href="javascript:void(0);"><?=__('row added','cf7-grid-layout')?></a>
35 </li>
36 <li><?= __('Event: ','cf7-grid-layout')?>
37 <a class="helper" data-cf72post="/* event fired when a table row has been deleted, click to insert helper code into your js file. */
38 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgRowDeleted', '.container.cf7-sg-table', function(e){
39 //$form current form jquery object.
40 //$table table jquery object.
41 let $form = $(e.delegateTarget), $table = $(e.target);
42 });" href="javascript:void(0);"><?=__('row removed','cf7-grid-layout')?></a>
43 </li>
44 <li><?= __('Function: ','cf7-grid-layout')?>
45 <a class="helper" data-cf72post="//call this function once the table is ready.
46 //$table is the table sectoin jquery object.
47 //adds an extra row, and fires a row added event.
48 $table.cf7sgCloneRow(); /* function to programmatically add a row to a table if fields. */" href="javascript:void(0);"><?=__('add a row','cf7-grid-layout')?></a>
49 </li>
50 <li><?= __('Function: ','cf7-grid-layout')?>
51 <a class="helper" data-cf72post="//call this function once the table is ready.
52 //$table is the table sectoin jquery object.
53 //pass false to hide the button, true to enable the button.
54 $table.toggleCF7sgTableRowAddition(false); /* hide/show row addition button. */" href="javascript:void(0);"><?=__('toggle add button','cf7-grid-layout')?></a>
55 </li>
56 <li><?= __('Function: ','cf7-grid-layout')?>
57 <a class="helper" data-cf72post="//call this function once the table is ready.
58 //$table is the table sectoin jquery object.
59 //pass false to hide the button, true to enable the button.
60 $table.toggleCF7sgTableRowDeletion(false); /* hide/show row deletion button. */" href="javascript:void(0);"><?=__('toggle delete button','cf7-grid-layout')?></a>
61 </li>
62 </ul>
63 </li>
64 <li id="tab-events" class="display-none"><?=__('Tabs','cf7-grid-layout')?><span>&gt;</span>
65 <ul>
66 <li><?= __('Event: ','cf7-grid-layout')?>
67 <a class="helper" data-cf72post="/* event fired once the tabs has been initialised, click to insert helper code into your js file. */
68 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgTabsReady', function(e){
69 //$form current form jquery object.
70 //$tabs tabs jquery object.
71 let $form = $(this), $tabs = $(e.target);
72 });" href="javascript:void(0);"><?=__('tabs ready','cf7-grid-layout')?></a>
73 </li>
74 <li><?= __('Event: ','cf7-grid-layout')?>
75 <a class="helper" data-cf72post="/* event fired when a new tab is added, click to insert helper code into your js file. */
76 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgTabAdded', '.cf7-sg-tabs-panel', function(e){
77 //$form current form jquery object.
78 //$panel newly added panel jquery object.
79 //$panel.attr('id') == <initial-id>-<tIdx> where tab index (tIdx) is greater than 0.
80 let $form = $(this), $panel = $(e.target), tIdx = e['tab-index'];
81 });" href="javascript:void(0);"><?=__('tab added','cf7-grid-layout')?></a>
82 </li>
83 <li><?= __('Event: ','cf7-grid-layout')?>
84 <a class="helper" data-cf72post="/* event fired when a new tab is removed, click to insert helper code into your js file. */
85 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgTabRemoved', '.cf7-sg-tabs', function(e){
86 //$form current form jquery object.
87 //$tabs tab jquery object from which the panel was removed.
88 let $form = $(this), $tabs = $(e.target);
89 });" href="javascript:void(0);"><?=__('tab removed','cf7-grid-layout')?></a>
90 </li>
91 <li><?= __('Function: ','cf7-grid-layout')?>
92 <a class="helper" data-cf72post="
93 //call this function once the tabs are ready.
94 //adds an extra tab, and fires a tab added event.
95 $tabs.cf7sgCloneTab(); /* function to programmatically add a tab. */" href="javascript:void(0);"><?=__('add a tab','cf7-grid-layout')?></a>
96 </li>
97 <li><?= __('Function: ','cf7-grid-layout')?>
98 <a class="helper" data-cf72post="
99 //call this function once the tabs are ready.
100 //to disable the tab addition pass false, to enable it pass true.
101 $tabs.toggleCF7sgTabAddition(false); /* disable/enable tab addition. */" href="javascript:void(0);"><?=__('toggle add button','cf7-grid-layout')?></a>
102 </li>
103 <li><?= __('Function: ','cf7-grid-layout')?>
104 <a class="helper" data-cf72post="
105 //call this function once the tabs are ready.
106 //to disable the tab deletion pass false, to enable it pass true.
107 $tabs.toggleCF7sgTabDeletion(false); /* disable/enable tab deletion. */" href="javascript:void(0);"><?=__('toggle delete button','cf7-grid-layout')?></a>
108 </li>
109 </ul>
110 </li>
111 <li id="collapsible-events" class="display-none"><?=__('Collapsible rows','cf7-grid-layout')?><span>&gt;</span>
112 <ul>
113 <li><?= __('Event: ','cf7-grid-layout')?>
114 <a class="helper" data-cf72post="/* event fired once the collapsible rows (accordion/toggle/sections) have been initialised */
115 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgCollapsibleRowsReady', function(e){
116 let $form = $(this), $section = $(e.target);
117 });" href="javascript:void(0);"><?=__('section ready','cf7-grid-layout')?></a>
118 </li>
119 <li><?= __('Event: ','cf7-grid-layout')?>
120 <a class="helper" data-cf72post="/* event fired when a collapsible section (accordion/toggle/section) is activated, click to insert helper code into your js file. */
121 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'accordionactivate', function(e, ui){
122 //this event is fired if the section is either closed or opened.
123 //for single collapsed sections,
124 // when openned, ui.oldPanel is empty and ui.newPanel is the current opened panel.
125 // when closed, ui.oldPanel is the currently closed panel and ui.newPanel is empty.
126 //for accordion with multile rows,
127 // ui.oldPanel is the previous panel (else empty if first actiation), ui.newPanel is the current opened panel.
128 //see https://api.jqueryui.com/accordion/#event-activate for more details.
129 let $form = $(this), $section = $(e.target);
130 switch(true){
131 case $section.is('.with-toggle'):
132 //this is a toggled section, identify it by its CSS id $this.attr('id').
133 break;
134 case $section.is('.cf7sg-accordion-rows'):
135 //this is an accordion with multiple collapsible sections, identify it by its CSS id $this.attr('id')
136 break;
137 default: //this is a single collapsible section.
138 //identify it by its CSS id $this.attr('id')
139 break;
140 }
141 });" href="javascript:void(0);"><?=__('section activated','cf7-grid-layout')?></a>
142 </li>
143 <li><?= __('Function: ','cf7-grid-layout')?>
144 <a class="helper all-fields" data-cf72post="
145 // $section is the collapsible section jquery object.
146 // you can either pass true (open, activate), or false (close) to the function.
147 $section.activateCF7sgCollapsibleSection(true);/* toggle open/close a collapsible section. */" href="javascript:void(0);"><?=__('open/close section','cf7-grid-layout')?></a>
148 </li>
149 </ul>
150 </li>
151 <li id="slider-events" class="display-none"><?=__('Slides','cf7-grid-layout')?><span>&gt;</span>
152 <ul>
153 <li><?= __('Event: ','cf7-grid-layout')?>
154 <a class="helper" data-cf72post="/* event fired once the slider has been initialised, click to insert helper code into your js file. */
155 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgSliderReady','.cf7sg-slider-section', function(e){
156 // $form is the form jquery object.
157 //the $slider is the div.cf7sg-slider-section element jquery object.
158 let $form = $(e.delegateTarget), $slider = $(this);
159 });" href="javascript:void(0);"><?=__('slider ready','cf7-grid-layout')?></a>
160 </li>
161 <li><?= __('Event: ','cf7-grid-layout')?>
162 <a class="helper" data-cf72post="/* event fired after a new slide is active, click to insert helper code into your js file. */
163 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgAfterSlideChange','.cf7sg-slider-section', function(e){
164 //e['prev-slide'] holds the index to the previous slide, empty on the first slide.
165 //e['current-slide'] holds the index of the current slide
166 //e['last-slide'] holds the index of the last slide.
167 //you can add a CSS id to each div.container.cf7sg-collapsible elements
168 // whithin the div.cf7sg-slider-section element to uniquely identify each slide $slide.attr('id');
169 // $form is the form jquery object.
170 let $form = $(e.delegateTarget), $slider=$(this), $slide = $(e.target);
171 });" href="javascript:void(0);"><?=__('after slide change','cf7-grid-layout')?></a>
172 </li>
173 <li><?= __('Event: ','cf7-grid-layout')?>
174 <a class="helper" data-cf72post="/* event fired before a new slide is activated, click to insert helper code into your js file. */
175 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'sgBeforeSlideChange','.cf7sg-slider-section', function(e){
176 //e['prev-slide'] holds the index to the previous slide, empty on the first slide.
177 //e['current-slide'] holds the index of the current slide
178 //e['last-slide'] holds the index of the last slide.
179 //you can add a CSS id to each div.container.cf7sg-collapsible elements
180 // whithin the div.cf7sg-slider-section element to uniquely identify each slide $(this).attr('id');
181 let $form = $(this), $slider=$(this), $slide = $(e.target);
182 //check if this is the last slide: e['current-slide']==e['last-slide']
183 });" href="javascript:void(0);"><?=__('before slide change','cf7-grid-layout')?></a>
184 </li>
185 <li><?= __('Function: ','cf7-grid-layout')?>
186 <a class="helper slider" data-cf72post="
187 // $slider is the slider jquery object.
188 $slider.goToNextSlide();/* activate the next slide. */" href="javascript:void(0);"><?=__('activate next slide','cf7-grid-layout')?></a>
189 </li>
190 <li><?= __('Function: ','cf7-grid-layout')?>
191 <a class="helper slider" data-cf72post="
192 // $slider is the slider jquery object.
193 $slider.goToPrevSlide();/* activate the previous slide. */" href="javascript:void(0);"><?=__('activate prev slide','cf7-grid-layout')?></a>
194 </li>
195 </ul>
196 </li>
197 <li id="field-events" class="show-events"><?=__('Form fields','cf7-grid-layout')?><span>&gt;</span>
198 <ul>
199 <li><?= __('Event: ','cf7-grid-layout')?>
200 <a class="helper all-fields" data-cf72post="/* event fired when a field changes value, click to insert helper code into your js file. */
201 $('#cf7sg-form-{$cf7_key} form.wpcf7-form').on( 'change',':input', function(e){
202 let $form = $(e.delegateTarget), $field=$(this), fieldName = $field.attr('name');
203 {$array_field_extraction}
204 // $form is the form jquery object.
205 // $field is the input field jquery object.
206 //
207 switch(fieldName){{$list_of_fields}}
208 });" href="javascript:void(0);"><?=__('value change','cf7-grid-layout')?></a>
209 </li>
210 <li><?= __('Function: ','cf7-grid-layout')?>
211 <a class="helper all-fields" data-cf72post="
212 // $form is the form jquery object.
213 // fieldName is the name of the field you need to retrieve.
214 // you can use tab/row indexes to retrieve fields in tabbed sections and/or table structures.
215 $field = $form.getCF7field(fieldName);/* function to retrieve a form field. */
216 //if your field is in a tabbed/table structure OR a table within a tabbed section,
217 //$form.getCF7field(fieldName, {'row':1,'tab':1}) - retrieves field on row 2 of tab 2.
218 //$form.getCF7field(fieldName, {'row':0}) - field on first row OR all first row fields on all tabs.
219 //$form.getCF7field(fieldName, {'tab':1}) - field in first tab OR fields of all rows on first tab.
220 //$form.getCF7field(fieldName) - field in form OR all fields of all rows on all tabs." href="javascript:void(0);"><?=__('get form field','cf7-grid-layout')?></a>
221 </li>
222 <li><?= __('Function: ','cf7-grid-layout')?>
223 <a class="helper" data-cf72post="
224 //call this function on a jQuery field object to display a dismissible warning/message popup.
225 //you can set an optional timeout in ms (1000ms = 1sec), after which the message will be automatically removed without user action.
226 $field.cf7sgWarning(message, timeout); /* function to display a dismissible field warning/message. */" href="javascript:void(0);"><?=__('display a message','cf7-grid-layout')?></a>
227 </li>
228 </ul>
229 </li>
230 <li id="other-events" class="display-none"><?=__('Others','cf7-grid-layout')?><span>&gt;</span>
231 <ul>
232 <?php do_action('cf7sg_admin_form_editor_jstags_other_items');?>
233 </ul>
234 </li>
235 <li id="last-item">
236 <label for="cf7sg-jstags-comments">
237 <?php
238 $checked=' checked=""';
239 if(get_post_meta($post->ID, '_cf7sg_disable_jstags_comments',true)) $checked= '';
240 ?>
241 <input id="cf7sg-jstags-comments" type="checkbox" name="cf7sg_jstags_comments" value="true"<?=$checked?>/>
242 <?=__('Show comments in helper code','cf7-grid-layout')?>
243 </label>
244 <?php do_action('cf7sg_admin_form_editor_jstags_last_item');?>
245 </li>
246 </ul>
247