PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 3.3.3
Smart Grid-Layout Design for Contact Form 7 v3.3.3
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 / js / mail-tag-helper.js

mail-tag-helper.js in Smart Grid-Layout Design for Contact Form 7 3.3.3, at admin/js/mail-tag-helper.js

36 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 (function( $ ) {
3 'use strict';
4 var $mailtags
5 $(document).ready(function(){
6
7 $('span.mailtag.code', '#wpcf7-mail').each(function(){
8 var $this = $(this);
9 var tag = $this.text().replace(/\[(.+)\]/g,'$1');
10 var $help = $('<a class="helper" data-tag="'+tag+'" href="javascript:void(0);"><span class="dashicons dashicons-info"></span></a>');
11 $(this).after($help);
12 new Clipboard($help[0], {
13 text: function(trigger) {
14 var form = $('#post_name').val();
15 if(!form) form = 'my-form';
16
17 var ftag = $(trigger).data('tag').replace('-','_');
18 var text = "add_filter( 'cf7sg_mailtag_"+$(trigger).data('tag')+"', 'filter_cf7_mailtag_"+ftag+"', 10, 3);\n";
19 text += "function filter_cf7_mailtag_"+ftag+"($tag_replace, $submitted, $cf7_key){\n";
20 text += " /*the $tag_replace string to change*/\n";
21 text += " /*the $submitted an array containing all submitted fields*/\n";
22 text += " /*the $cf7_key is a unique string key to identify your form, which you can find in your form table in the dashboard.*/\n"
23 text += " if('"+form+"'==$cf7_key ){\n";
24 text += " $tag_replace = ... //change the "+$(trigger).data('tag')+".\n";
25 text += " }\n";
26 text += "return $tag_replace;\n";
27 text += "}\n";
28 return text;
29 }
30 });
31 var helper = mailTagHelper.filter.replace('%s', '<span class="tag-colour">'+tag+'</span>');
32 $help.after('<span class="helper">'+helper+', '+mailTagHelper.msg+'</span>');
33 })
34 })
35 })( jQuery );
36