PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / application / views / search_fields / CATEGORY_CHECKBOXES.php

CATEGORY_CHECKBOXES.php in WP Directory Kit 1.5.9, at application/views/search_fields/CATEGORY_CHECKBOXES.php

75 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Search field CATEGORY.
4 *
5 * This is the template that field layout for search form
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 ?>
13 <?php
14 $field_key = 'search_category';
15 $field_attr_id = 'wdk_search_'.wmvc_show_data('idfield', $field_data);
16 $placeholder = wmvc_show_data('field_label', $field_data);
17 $field_value = '';
18 // Dynamic field values are registered in the translation catalog separately.
19 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
20 $placeholder = esc_html__($placeholder,'wpdirectorykit');
21
22 $filter_ids = array();
23 if(isset($predefinedfields_query) && !empty($predefinedfields_query[$field_key])) {
24 $field_value = intval($predefinedfields_query[$field_key]);
25 }
26
27 if(isset($predefinedfields_query) && !empty($predefinedfields_query['custom_category_root'])) {
28 $custom_field_value = intval($predefinedfields_query['custom_category_root']);
29 global $Winter_MVC_WDK;
30 $Winter_MVC_WDK->load_helper('listing');
31 $Winter_MVC_WDK->model('category_m');
32 $category = $Winter_MVC_WDK->category_m->get($custom_field_value, TRUE);
33
34 /* if root search childs */
35 if($category) {
36 $filter_ids = wdk_category_get_all_childs($custom_field_value);
37 if(!empty($filter_ids)) {
38 if(in_array($field_value, $filter_ids) === FALSE) {
39 $field_value = $custom_field_value;
40 }
41 }
42 } else {
43 /* category missing */
44 $custom_field_value = null;
45 }
46 }
47
48 if(isset($_GET[$field_key])) {
49 $field_value = ($_GET[$field_key]);
50 }
51
52 $hide_fields = '';
53 if(wmvc_show_data('search_type_tree_hide', $field_data)) {
54 $hide_fields = wmvc_show_data('search_type_tree_hide', $field_data);
55 }
56
57 wdk_search_fields_toggle();
58 ?>
59
60 <div class="wdk-field wdk-col <?php echo esc_attr(wmvc_show_data('field_type', $field_data)); ?> <?php echo esc_attr(wmvc_show_data('class', $field_data)); ?>">
61 <label class="wdk-field-label"><?php echo esc_html(wmvc_show_data('field_label', $field_data)); ?></label>
62 <div class="wdk-field-group">
63 <?php
64 wp_enqueue_style( 'wdk-treefield-checkboxes');
65 wp_enqueue_script( 'wdk-treefield-checkboxes');
66 ?>
67
68 <?php if(isset($custom_field_value)):?>
69 <input type="hidden" name="search_category[]" value="<?php echo esc_attr($custom_field_value);?>">
70 <?php endif;?>
71 <?php
72 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText
73 echo wdk_treefield_option_checkboxes ('search_category', 'category_m', $field_value, 'category_title', '', __('All Categories', 'wpdirectorykit'), $filter_ids, FALSE, '', $hide_fields);?>
74 </div>
75 </div>