GFDirectory_EditForm

The Gravity Forms Directory & Addons GFDirectory EditForm class.

Defined (1)

The class is defined in the following location(s).

/edit-form.php  
  1. class GFDirectory_EditForm { 
  2.  
  3. static public function initialize() { 
  4. $GFDirectory_EditForm = new GFDirectory_EditForm(); 
  5.  
  6. function __construct() { 
  7.  
  8. add_action('admin_init', array(&$this, 'process_exterior_pages')); 
  9.  
  10. if(self::is_gravity_page() ) { 
  11.  
  12. add_filter('admin_head', array(&$this, 'directory_admin_head')); 
  13.  
  14. if( isset($_REQUEST['id'] ) ) { 
  15. add_filter('gform_tooltips', array(&$this, 'directory_tooltips')); //Filter to add a new tooltip 
  16. add_action("gform_editor_js", array(&$this, "editor_script")); //Action to inject supporting script to the form editor page 
  17. add_action("admin_head", array(&$this, "toolbar_links")); //Action to inject supporting script to the form editor page 
  18. add_action("gform_field_advanced_settings", array(&$this, "use_as_entry_link_settings"), 10, 2); 
  19. add_filter("gform_add_field_buttons", array(&$this, "add_field_buttons")); 
  20. add_action('gform_editor_js_set_default_values', array(&$this, 'directory_add_default_values')); 
  21.  
  22. // From gravityforms.php 
  23. public static function process_exterior_pages() { 
  24. if(rgempty("gf_page", $_GET)) 
  25. return; 
  26.  
  27. //ensure users are logged in 
  28. if(!is_user_logged_in()) 
  29. auth_redirect(); 
  30.  
  31. switch(rgget("gf_page")) { 
  32. case "directory_columns" : 
  33. require_once("select_directory_columns.php"); 
  34. break; 
  35. exit(); 
  36.  
  37. public function directory_add_default_values() { 
  38. ?> 
  39. case "entrylink" : 
  40. field.label = "<?php echo esc_js( __("Go to Entry", "gravity-forms-addons") ); ?>"; 
  41. field.adminOnly = true; 
  42. field.choices = null; 
  43. field.inputs = null; 
  44. field.hideInSingle = true; 
  45. field.useAsEntryLink = 'label'; 
  46. field.type = 'hidden'; 
  47. field.disableMargins = true; 
  48.  
  49. break; 
  50.  
  51. case 'usereditlink': 
  52. field.label = "<?php echo esc_js( __("Edit", "gravity-forms-addons") ); ?>"; 
  53.  
  54. field.adminOnly = true; 
  55. field.choices = null; 
  56. field.inputs = null; 
  57. field.hideInSingle = false; 
  58. field.useAsEntryLink = false; 
  59. field.type = 'hidden'; 
  60. field.disableMargins = 2; 
  61.  
  62. break; 
  63.  
  64. case 'directoryapproved': 
  65. field.label = "<?php echo esc_js( __("Approved? (Admin-only)", "gravity-forms-addons")); ?>"; 
  66.  
  67. field.adminLabel = "<?php echo esc_js( __("Approved?", "gravity-forms-addons")); ?>"; 
  68. field.adminOnly = true; 
  69.  
  70. field.choices = null; 
  71. field.inputs = null; 
  72.  
  73. if(!field.choices) 
  74. field.choices = new Array(new Choice("<?php echo esc_js( __("Approved", "gravity-forms-addons")); ?>")); 
  75.  
  76. field.inputs = new Array(); 
  77. for(var i=1; i<=field.choices.length; i++) 
  78. field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text)); 
  79.  
  80. field.hideInDirectory = true; 
  81. field.hideInSingle = true; 
  82. field.type = 'checkbox'; 
  83.  
  84. break; 
  85. <?php 
  86.  
  87. public function directory_admin_head() { 
  88. global $_gform_directory_approvedcolumn, $process_bulk_update_message; 
  89.  
  90. // Entries screen shows first form's entries by default, if not specified 
  91. if( isset( $_GET['id'] ) ) { 
  92. $formID = $_GET['id']; 
  93. } else { 
  94. if( class_exists('RGFormsModel') ) { 
  95. $forms = RGFormsModel::get_forms(null, "title"); 
  96. $formID = $forms[0]->id; 
  97.  
  98. if( !( self::is_gravity_page('gf_entries') && isset( $formID ) && !self::is_gravity_page('gf_edit_forms') ) ) { return; } 
  99.  
  100. // Don't display on single entry view. 
  101. if( !empty( $_GET['view'] ) && $_GET['view'] === 'entry' ) { 
  102. return; 
  103.  
  104. ?> 
  105. <style> 
  106.  
  107. .lead_approved .toggleApproved { 
  108. background: url(<?php echo plugins_url('images/tick.png', __FILE__); ?>) left top no-repeat; 
  109. .toggleApproved { 
  110. background: url(<?php echo plugins_url('images/cross.png', __FILE__); ?>) left top no-repeat; 
  111. width: 16px; 
  112. height: 16px; 
  113. display: block; 
  114. text-indent: -9999px; 
  115. overflow: hidden; 
  116. </style> 
  117. <script> 
  118.  
  119. <?php 
  120.  
  121. //$formID = RGForms::get("id"); 
  122.  
  123. if(empty($formID)) { 
  124. $forms = RGFormsModel::get_forms(null, "title"); 
  125. $formID = $forms[0]->id; 
  126.  
  127. $_gform_directory_approvedcolumn = empty($_gform_directory_approvedcolumn) ? GFDirectory::globals_get_approved_column($formID) : $_gform_directory_approvedcolumn; 
  128.  
  129. if(!empty($_gform_directory_approvedcolumn)) { 
  130. echo 'formID = '.$formID.';'; 
  131. ?> 
  132.  
  133. function UpdateApproved(lead_id, approved) { 
  134. var mysack = new sack("<?php echo admin_url("admin-ajax.php")?>" ); 
  135. mysack.execute = 1; 
  136. mysack.method = 'POST'; 
  137. mysack.setVar( "action", "rg_update_approved" ); 
  138. mysack.setVar( "rg_update_approved", "<?php echo wp_create_nonce("rg_update_approved") ?>" ); 
  139. mysack.setVar( "lead_id", lead_id); 
  140. mysack.setVar( "form_id", formID); 
  141. mysack.setVar( "approved", approved); 
  142. mysack.encVar( "cookie", document.cookie, false ); 
  143. mysack.onError = function() { console.log('<?php echo esc_js(__("Ajax error while setting lead approval", "gravity-forms-addons")) ?>' )}; 
  144. mysack.runAJAX(); 
  145.  
  146. return true; 
  147.  
  148. <?php 
  149.  
  150. if(!function_exists('gform_get_meta')) { ?> 
  151.  
  152. function displayMessage(message, messageClass, container) { 
  153.  
  154. hideMessage(container, true); 
  155.  
  156. var messageBox = jQuery('<div class="message ' + messageClass + '" style="display:none;"><p>' + message + '</p></div>'); 
  157. jQuery(messageBox).prependTo(container).slideDown(); 
  158.  
  159. if(messageClass == 'updated') 
  160. messageTimeout = setTimeout(function() { hideMessage(container, false); }, 10000); 
  161.  
  162.  
  163. function hideMessage(container, messageQueued) { 
  164.  
  165. var messageBox = jQuery(container).find('.message'); 
  166.  
  167. if(messageQueued) 
  168. jQuery(messageBox).remove(); 
  169. else 
  170. jQuery(messageBox).slideUp(function() { jQuery(this).remove(); }); 
  171.  
  172.  
  173. <?php } // end meta check for 1.6 ?> 
  174.  
  175. jQuery(document).ready(function($) { 
  176.  
  177. <?php if(!empty($process_bulk_update_message)) { ?> 
  178. displayMessage('<?php echo esc_js($process_bulk_update_message); ?>', 'updated', '#lead_form'); 
  179. <?php } ?> 
  180.  
  181. $("#bulk_action, #bulk_action2").append('<optgroup label="Directory"><option value="approve-'+formID+'"><?php echo esc_js( __('Approve', 'gravity-forms-addons')); ?></option><option value="unapprove-'+formID+'"><?php echo esc_js( __('Disapprove', 'gravity-forms-addons')); ?></option></optgroup>'); 
  182.  
  183. var approveTitle = '<?php echo esc_js( __('Entry not approved for directory viewing. Click to approve this entry.', 'gravity-forms-addons')); ?>'; 
  184. var unapproveTitle = '<?php echo esc_js( __('Entry approved for directory viewing. Click to disapprove this entry.', 'gravity-forms-addons')); ?>'; 
  185.  
  186. $(document).on('click load', '.toggleApproved', function(e) { 
  187. e.preventDefault(); 
  188.  
  189. var $tr = $(this).parents('tr'); 
  190. var is_approved = $tr.is(".lead_approved"); 
  191.  
  192. if(e.type == 'click') { 
  193. $tr.toggleClass("lead_approved"); 
  194.  
  195. // Update the title and screen-reader text 
  196. if(!is_approved) { $(this).text('X').prop('title', unapproveTitle); } 
  197. else { $(this).text('O').prop('title', approveTitle); } 
  198.  
  199. if(e.type == 'click') { 
  200. UpdateApproved($('th input[type="checkbox"]', $tr).val(), is_approved ? 0 : 'Approved'); 
  201.  
  202. UpdateApprovedColumns($(this).parents('table'), false); 
  203.  
  204. return false; 
  205.  
  206. }); 
  207.  
  208. // We want to make sure that the checkboxes go away even if the Approved column is showing. 
  209. // They will be in sync when loaded, so only upon click will we process. 
  210. function UpdateApprovedColumns($table, onLoad) { 
  211. var colIndex = $('th:contains("Approved")', $table).index() - 1; 
  212.  
  213. $('tr', $table).each(function() { 
  214. if($(this).is('.lead_approved') || (onLoad && $("input.lead_approved", $(this)).length > 0)) { 
  215. if(onLoad && $(this).not('.lead_approved')) { $(this).addClass('lead_approved'); } 
  216. $('td:visible:eq('+colIndex+'):has(.toggleApproved)', $(this)).html("<img src='<?php echo plugins_url('images/tick.png', __FILE__); ?>/>"); 
  217. } else { 
  218. if(onLoad && $(this).is('.lead_approved')) { $(this).removeClass('lead_approved'); } 
  219. $('td:visible:eq('+colIndex+'):has(.toggleApproved)', $(this)).html(''); 
  220. }); 
  221.  
  222. $('td:has(img[src*="star"])').after('<td><a href="#" class="toggleApproved" title="'+approveTitle+'">X</a></td>'); 
  223. $('th.check-column:eq(1)').after('<th class="manage-column column-cb check-column"><a href="<?php echo esc_url( add_query_arg(array('sort' => $_gform_directory_approvedcolumn)) ); ?>"><img src="<?php echo plugins_url( '/images/form-button-1.png', __FILE__); ?>" style="text-align:center; margin:0 auto; display:block;" title="<?php echo esc_js( __('Show entry in directory view?', 'gravity-forms-addons')); ?>" /></span></a></th>'); 
  224.  
  225. $('tr:has(input.lead_approved)').addClass('lead_approved').find('a.toggleApproved').prop('title', unapproveTitle).text('O'); 
  226.  
  227. UpdateApprovedColumns($('table'), true); 
  228.  
  229. }); 
  230. <?php } // end if(!empty($_gform_directory_approvedcolumn)) check ?> 
  231. </script><?php 
  232.  
  233. public function use_as_entry_link_settings($position, $form_id) { 
  234.  
  235. //create settings on position 50 (right after Admin Label) 
  236. if($position === -1) : ?> 
  237. </ul> 
  238. </div> 
  239. <div id="gform_tab_directory"> 
  240. <ul> 
  241. <li class="use_as_entry_link gf_directory_setting field_setting"> 
  242. <label for="field_use_as_entry_link"> 
  243. <?php esc_html_e("Use As Link to Single Entry", "gravity-forms-addons"); ?> 
  244. <?php gform_tooltip("kws_gf_directory_use_as_link_to_single_entry") ?> 
  245. </label> 
  246. <label for="field_use_as_entry_link"><input type="checkbox" value="1" id="field_use_as_entry_link" /> <?php esc_html_e("Use this field as a link to single entry view", "gravity-forms-addons"); ?></label> 
  247. </li> 
  248. <li class="use_as_entry_link_value gf_directory_setting field_setting"> 
  249. <label> 
  250. <?php esc_html_e("Single Entry Link Text", "gravity-forms-addons"); ?> 
  251. <span class="howto"><?php esc_html_e('Note: it is a good idea to use required fields for links to single entries so there are no blank links.', 'gravity-forms-addons'); ?></span> 
  252. </label> 
  253.  
  254. <label><input type="radio" name="field_use_as_entry_link_value" id="field_use_as_entry_link_value" value="on" /> <?php esc_html_e("Use field values from entry", "gravity-forms-addons"); ?></label> 
  255. <label><input type="radio" name="field_use_as_entry_link_value" id="field_use_as_entry_link_label" value="label" /> <?php printf( esc_html( "Use the Field Label %s as link text", 'gravity-forms-addons'), '<span id="entry_link_label_text"></span>'); ?></label> 
  256. <label><input type="radio" name="field_use_as_entry_link_value" id="field_use_as_entry_link_custom" value="custom" /> <?php esc_html_e("Use custom link text.", "gravity-forms-addons"); ?></label> 
  257. <span class="hide-if-js" style="display:block;clear:both; margin-left:1.5em"><input type="text" class="widefat" id="field_use_as_entry_link_value_custom_text" value="" /><span class="howto"><?php printf(esc_html('%s%%value%%%s will be replaced with each entry\'s value.', 'gravity-forms-addons'), "<code class='code'>", '</code>'); ?></span></span> 
  258. </li> 
  259. <li class="hide_in_directory_view only_visible_to_logged_in only_visible_to_logged_in_cap gf_directory_setting field_setting"> 
  260. <label for="hide_in_directory_view"> 
  261. <?php esc_html_e("Hide This Field in Directory View?", "gravity-forms-addons"); ?> 
  262. <?php gform_tooltip("kws_gf_directory_hide_in_directory_view") ?> 
  263. </label> 
  264. <label><input type="checkbox" id="hide_in_directory_view" /> <?php esc_html_e("Hide this field in the directory view.", "gravity-forms-addons"); ?></label> 
  265.  
  266. <label> 
  267. <input type="checkbox" id="only_visible_to_logged_in" /> <?php esc_html_e("Only visible to logged in users with the following role:", "gravity-forms-addons"); ?> 
  268. <select id="only_visible_to_logged_in_cap"> 
  269. <option value="read"><?php esc_html_e("Any", "gravity-forms-addons"); ?></option> 
  270. <option value="publish_posts"><?php esc_html_e("Author or higher", "gravity-forms-addons"); ?></option> 
  271. <option value="delete_others_posts"><?php esc_html_e("Editor or higher", "gravity-forms-addons"); ?></option> 
  272. <option value="manage_options"><?php esc_html_e("Administrator", "gravity-forms-addons"); ?></option> 
  273. </select> 
  274. </label> 
  275.  
  276. </li> 
  277. <li class="hide_in_single_entry_view gf_directory_setting field_setting"> 
  278. <label for="hide_in_single_entry_view"> 
  279. <?php esc_html_e("Hide This Field in Single Entry View?", "gravity-forms-addons"); ?> 
  280. <?php gform_tooltip("kws_gf_directory_hide_in_single_entry_view") ?> 
  281. </label> 
  282. <label><input type="checkbox" id="hide_in_single_entry_view" /> <?php esc_html_e("Hide this field in the single entry view.", "gravity-forms-addons"); ?></label> 
  283. </li> 
  284. <li class="use_field_as_search_filter gf_directory_setting field_setting"> 
  285. <label for="use_field_as_search_filter"> 
  286. <?php esc_html_e("Directory Search Field", "gravity-forms-addons"); ?> 
  287. <?php gform_tooltip("kws_gf_directory_use_field_as_search_filter") ?> 
  288. </label> 
  289. <label for="use_field_as_search_filter"><input type="checkbox" id="use_field_as_search_filter" /> <?php esc_html_e("Use this field as a search filter", "gravity-forms-addons"); ?></label> 
  290. </li> 
  291. <?php endif; 
  292.  
  293. public function toolbar_links() { 
  294. wp_enqueue_style( 'thickbox' ); 
  295. ?> 
  296. <script type='text/javascript'> 
  297. jQuery(document).ready(function($) { 
  298. var url = '<?php echo add_query_arg(array('gf_page' => 'directory_columns', 'id' => @$_GET['id'], 'TB_iframe' => 'true', 'height' => 600, 'width' => 700), admin_url()); ?>'; 
  299. $link = $('<li class="gf_form_toolbar_preview gf_form_toolbar_directory" id="gf_form_toolbar_directory"><a href="'+url+'" class="thickbox" title="<?php echo esc_js(__('Modify Gravity Forms Directory Columns', 'gravity-forms-addons')); ?>"><i class="dashicons dashicons-welcome-widgets-menus" style="line-height:17px"></i> <?php echo esc_js( __('Directory Columns', 'gravity-forms-addons')); ?></a></li>'); 
  300. $('#gf_form_toolbar_links').append($link); 
  301. }); 
  302. </script> 
  303. <?php 
  304.  
  305. public function editor_script() { 
  306. ?> 
  307. <style> 
  308. li.gf_directory_setting, li.gf_directory_setting li { 
  309. padding-bottom: 4px!important; 
  310. </style> 
  311. <script> 
  312. jQuery(document).ready(function($) { 
  313.  
  314. // instead of simply .tabs('add')... 
  315. $('<li><a href="#gform_tab_directory"><?php echo esc_js( __('Directory', 'gravity-forms-addons')); ?></a></li>' ).appendTo('#field_settings .ui-tabs-nav'); 
  316. $('#gform_tab_directory').appendTo( "#field_settings" ); 
  317. $( '#field_settings' ).tabs( "refresh" ); 
  318.  
  319. $('a[href="#gform_tab_directory"]').parent('li').css({'width':'100px', 'padding':'0'}); 
  320.  
  321. for (var key in fieldSettings) { 
  322. fieldSettings[key] += ", .gf_directory_setting"; 
  323.  
  324. $('#field_use_as_entry_link_value_custom_text').change(function() { 
  325. if($("#field_use_as_entry_link_custom").is(':checked')) { 
  326. SetFieldProperty('useAsEntryLink', $(this).val()); 
  327. }); 
  328.  
  329. $("input:checkbox, input:radio", $('#gform_tab_directory')).click(function() { 
  330. var $li = $(this).parents('#field_settings'); 
  331. var entrylink = false; 
  332.  
  333. if($("#field_use_as_entry_link", $li).is(":checked")) { 
  334. entrylink = '1'; 
  335.  
  336. $('.use_as_entry_link_value').slideDown(); 
  337.  
  338. if($('input[name="field_use_as_entry_link_value"]:checked').length) { 
  339. entrylink = $('input[name="field_use_as_entry_link_value"]:checked').val(); 
  340. if(entrylink == 'custom') { 
  341. entrylink = $('#field_use_as_entry_link_value_custom_text').val(); 
  342. $('#field_use_as_entry_link_value_custom_text').parent('span').slideDown(); 
  343. } else { 
  344. $('#field_use_as_entry_link_value_custom_text').parent('span').slideUp(); 
  345. } else { 
  346. $('.use_as_entry_link_value', $li).slideUp(); 
  347.  
  348. var hideInSingle = false; 
  349. if($("#hide_in_single_entry_view", $li).is(':checked')) { 
  350. hideInSingle = true; 
  351.  
  352. var hideInDirectory = false; 
  353. if($("#hide_in_directory_view", $li).is(':checked')) { 
  354. hideInDirectory = true; 
  355. SetFieldProperty('hideInDirectory', hideInDirectory); 
  356. SetFieldProperty('hideInSingle', hideInSingle); 
  357. SetFieldProperty('useAsEntryLink', entrylink); 
  358.  
  359. // since 3.5 
  360. var visibleToLoggedIn = false; 
  361. if($("#only_visible_to_logged_in", $li).is(':checked')) { 
  362. visibleToLoggedIn = true; 
  363. SetFieldProperty('visibleToLoggedIn', visibleToLoggedIn); 
  364.  
  365. var isSearchFilter = false; 
  366. if($("#use_field_as_search_filter", $li).is(':checked')) { 
  367. isSearchFilter = true; 
  368. SetFieldProperty('isSearchFilter', isSearchFilter ); 
  369.  
  370. }); 
  371.  
  372.  
  373. $('#field_label').change(function() { 
  374. kwsGFupdateEntryLinkLabel($(this).val()); 
  375. }); 
  376.  
  377. function kwsGFupdateEntryLinkLabel(label) { 
  378. $('#entry_link_label_text').html(' ("'+label+'")'); 
  379.  
  380.  
  381. $('#only_visible_to_logged_in_cap').change( function() { 
  382. if( $("#only_visible_to_logged_in").is(':checked') ) { 
  383. SetFieldProperty('visibleToLoggedInCap', $(this).val() ); 
  384.  
  385. }); 
  386.  
  387.  
  388.  
  389. //binding to the load field settings event to initialize the checkbox 
  390. $(document).bind("gform_load_field_settings", function(event, field, form) { 
  391.  
  392. if(typeof(field["useAsEntryLink"]) !== "undefined" && field["useAsEntryLink"] !== false && field["useAsEntryLink"] !== 'false' && field["useAsEntryLink"] !== '') { 
  393. $("#field_use_as_entry_link").prop("checked", true); 
  394. $(".use_as_entry_link_value").show(); 
  395. $('#field_use_as_entry_link_value_custom_text').parent('span').hide(); 
  396. switch(field["useAsEntryLink"]) { 
  397. case "on": 
  398. case "": 
  399. case false: 
  400. $("#field_use_as_entry_link_value").prop('checked', true); 
  401. break; 
  402. case "label": 
  403. $("#field_use_as_entry_link_label").prop('checked', true); 
  404. break; 
  405. default: 
  406. $('#field_use_as_entry_link_value_custom_text').parent('span').show(); 
  407. $("#field_use_as_entry_link_custom").prop('checked', true); 
  408. $("#field_use_as_entry_link_value_custom_text").val(field["useAsEntryLink"]); 
  409. } else { 
  410. $(".use_as_entry_link_value").hide(); 
  411. $("#field_use_as_entry_link").prop("checked", false); 
  412.  
  413. if($('input[name="field_use_as_entry_link_value"]:checked').length === 0) { 
  414. $('#field_use_as_entry_link_value').prop('checked', true); 
  415.  
  416. kwsGFupdateEntryLinkLabel(field.label); 
  417.  
  418.  
  419. $("#field_use_as_entry_link_label").prop("checked", field["useAsEntryLink"] === 'label'); 
  420.  
  421. $("#hide_in_single_entry_view").prop("checked", (field["hideInSingle"] === true || field["hideInSingle"] === "on")); 
  422. $("#hide_in_directory_view").prop("checked", (field["hideInDirectory"] === true || field["hideInDirectory"] === "on")); 
  423.  
  424. //since 3.5 
  425. $("#only_visible_to_logged_in").prop("checked", (field["visibleToLoggedIn"] === true || field["visibleToLoggedIn"] === "on")); 
  426. $("#only_visible_to_logged_in_cap").val( field["visibleToLoggedInCap"] ); 
  427. //since 3.5 
  428. $("#use_field_as_search_filter").prop("checked", (field["isSearchFilter"] === true || field["isSearchFilter"] === "on")); 
  429.  
  430.  
  431.  
  432. }); 
  433. }); 
  434. </script> 
  435. <?php 
  436.  
  437. public function directory_tooltips($tooltips) { 
  438. $tooltips["kws_gf_directory_use_as_link_to_single_entry"] = sprintf( esc_html__("%sLink to single entry using this field%sIf you would like to link to the single entry view using this link, check the box.", 'gravity-forms-addons'), '<h6>', '</h6>'); 
  439. $tooltips['kws_gf_directory_hide_in_directory_view'] = sprintf( esc_html__('%sHide in Directory View%sIf checked, this field will not be shown in the directory view, even if it is visible in the %sDirectory Columns%s. If this field is Admin Only (set in the Advanced tab), it will be hidden in the directory view unless "Show Admin-Only columns" is enabled in the directory. Even if "Show Admin-Only columns" is enabled, checking this box will hide the column in the directory view.', 'gravity-forms-addons'), '<h6>', '</h6>', sprintf('<a class="thickbox" title="%s" href="'.add_query_arg(array('gf_page' => 'directory_columns', 'id' => @$_GET['id'], 'TB_iframe' => 'true', 'height' => 600, 'width' => 700), admin_url()).'">', esc_html__('Modify Directory Columns', 'gravity-forms-addons')), '</a>'); 
  440. $tooltips['kws_gf_directory_hide_in_single_entry_view'] = sprintf( esc_html__('%sHide in Single Entry View%sIf checked, this field will not be shown in the single entry view of the directory.', 'gravity-forms-addons'), '<h6>', '</h6>'); 
  441. $tooltips['kws_gf_directory_use_field_as_search_filter'] = sprintf( esc_html__('%sDirectory Search Field%sIf checked, add search fields to the Directory search form. If this field is a text field, a text search input will be added that will search only this field. Otherwise, the field choices will be used to populate a dropdown menu search input. Example: if the field has choices "A", "B", and "C", the search dropdown will have those items as choices in a dropdown search field.', 'gravity-forms-addons'), '<h6>', '</h6>'); 
  442. return $tooltips; 
  443.  
  444. //Returns true if the current page is one of Gravity Forms pages. Returns false if not 
  445. private static function is_gravity_page($page = array()) { 
  446. return GFDirectory::is_gravity_page($page); 
  447.  
  448. function add_field_buttons($field_groups) { 
  449. $directory_fields = array( 
  450. 'name' => 'directory_fields',  
  451. 'label' => 'Directory Fields',  
  452. 'fields' => array( 
  453. array( 
  454. 'class' => 'button',  
  455. 'value' => esc_attr__('Approved', 'gravity-forms-addons'),  
  456. 'onclick' => "StartAddField('directoryapproved');" 
  457. ),  
  458. array( 
  459. 'class' => 'button',  
  460. 'value' => esc_attr__('Entry Link', 'gravity-forms-addons'),  
  461. 'onclick' => "StartAddField('entrylink');" 
  462. ),  
  463. array( 
  464. 'class' => 'button',  
  465. 'value' => esc_attr__('User Edit Link', 'gravity-forms-addons'),  
  466. 'onclick' => "StartAddField('usereditlink');" 
  467. ); 
  468.  
  469. array_push($field_groups, $directory_fields); 
  470.  
  471. return $field_groups;