1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* LSX Search Admin Class. |
4
|
|
|
* |
5
|
|
|
* @package lsx-search |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace lsx\search\classes; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* The administration class. |
12
|
|
|
*/ |
13
|
|
|
class Admin { |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Holds class instance |
17
|
|
|
* |
18
|
|
|
* @since 1.0.0 |
19
|
|
|
* |
20
|
|
|
* @var object \lsx\search\classes\Admin() |
21
|
|
|
*/ |
22
|
|
|
protected static $instance = null; |
23
|
|
|
/** |
24
|
|
|
* Holds the options for the search. |
25
|
|
|
* |
26
|
|
|
* @var array() |
27
|
|
|
*/ |
28
|
|
|
public $options = false; |
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Holds the facetwp data for use in the fields. |
32
|
|
|
* |
33
|
|
|
* @var array() |
34
|
|
|
*/ |
35
|
|
|
public $facet_data = false; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Holds the Alpha betical facetwp data for use in the fields. |
39
|
|
|
* |
40
|
|
|
* @var array() |
41
|
|
|
*/ |
42
|
|
|
public $az_facets = array(); |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Holds the settings page theme functions |
46
|
|
|
* |
47
|
|
|
* @var object \lsx\search\classes\admin\Settings_Theme(); |
48
|
|
|
*/ |
49
|
|
|
public $settings_theme; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Construct method. |
53
|
|
|
*/ |
54
|
|
|
public function __construct() { |
|
|
|
|
55
|
|
|
$this->load_classes(); |
56
|
|
|
add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
57
|
|
|
add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 ); |
58
|
|
|
add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 ); |
59
|
|
|
add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
60
|
|
|
|
61
|
|
|
if ( is_admin() ) { |
|
|
|
|
62
|
|
|
add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
63
|
|
|
add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 ); |
64
|
|
|
} |
65
|
|
|
} |
|
|
|
|
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Return an instance of this class. |
69
|
|
|
* |
70
|
|
|
* @since 1.0.0 |
71
|
|
|
* |
72
|
|
|
* @return object \lsx\member_directory\search\Admin() A single instance of this class. |
73
|
|
|
*/ |
74
|
|
|
public static function get_instance() { |
|
|
|
|
75
|
|
|
// If the single instance hasn't been set, set it now. |
76
|
|
|
if ( null === self::$instance ) { |
|
|
|
|
77
|
|
|
self::$instance = new self(); |
78
|
|
|
} |
79
|
|
|
return self::$instance; |
80
|
|
|
} |
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Loads the variable classes and the static classes. |
84
|
|
|
*/ |
85
|
|
|
private function load_classes() { |
|
|
|
|
86
|
|
|
require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php'; |
87
|
|
|
$this->settings_theme = admin\Settings_Theme::get_instance(); |
88
|
|
|
} |
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Configure Business Directory custom fields for the Settings page. |
92
|
|
|
* |
93
|
|
|
* @return void |
94
|
|
|
*/ |
95
|
|
|
public function register_settings_page() { |
|
|
|
|
96
|
|
|
$args = array( |
97
|
|
|
'id' => 'lsx_search_settings', |
98
|
|
|
'title' => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>', |
99
|
|
|
'menu_title' => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above). |
100
|
|
|
'object_types' => array( 'options-page' ), |
101
|
|
|
'option_key' => 'lsx-search-settings', // The option key and admin menu page slug. |
102
|
|
|
'parent_slug' => 'options-general.php', |
103
|
|
|
'capability' => 'manage_options', // Cap required to view options-page. |
104
|
|
|
); |
105
|
|
|
$cmb = new_cmb2_box( $args ); |
106
|
|
|
do_action( 'lsx_search_settings_page', $cmb ); |
107
|
|
|
} |
|
|
|
|
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Sets post types with active search options. |
111
|
|
|
*/ |
112
|
|
|
public function register_post_type_tabs( $post_types_plural ) { |
|
|
|
|
113
|
|
|
$post_types_plural = array( |
114
|
|
|
'project' => 'projects', |
|
|
|
|
115
|
|
|
'service' => 'services', |
|
|
|
|
116
|
|
|
'team' => 'team', |
|
|
|
|
117
|
|
|
'testimonial' => 'testimonials', |
118
|
|
|
'video' => 'videos', |
|
|
|
|
119
|
|
|
'product' => 'products', // WooCommerce |
|
|
|
|
120
|
|
|
'post' => 'posts', |
|
|
|
|
121
|
|
|
); |
122
|
|
|
return $post_types_plural; |
123
|
|
|
} |
|
|
|
|
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Gets the Tour Operator Post Types. |
127
|
|
|
* |
128
|
|
|
* @return array |
129
|
|
|
*/ |
130
|
|
|
public function get_to_post_types() { |
|
|
|
|
131
|
|
|
$to_types = array( |
132
|
|
|
'accommodation', |
133
|
|
|
'tour', |
134
|
|
|
'destination', |
135
|
|
|
'review', |
136
|
|
|
'activity', |
137
|
|
|
'special', |
138
|
|
|
'vehicle', |
139
|
|
|
); |
140
|
|
|
return $to_types; |
141
|
|
|
} |
|
|
|
|
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Sets the FacetWP variables. |
145
|
|
|
* |
146
|
|
|
* @return void |
147
|
|
|
*/ |
148
|
|
|
public function set_facetwp_vars() { |
|
|
|
|
149
|
|
|
if ( function_exists( '\FWP' ) ) { |
|
|
|
|
150
|
|
|
$facet_data = \FWP()->helper->get_facets(); |
|
|
|
|
151
|
|
|
} |
152
|
|
|
$this->facet_data = array(); |
153
|
|
|
$this->az_facets = array( |
154
|
|
|
'' => __( 'Do not show', 'lsx-search' ), |
155
|
|
|
); |
156
|
|
|
if ( ! empty( $facet_data ) && is_array( $facet_data ) ) { |
|
|
|
|
157
|
|
|
foreach ( $facet_data as $facet ) { |
|
|
|
|
158
|
|
|
if ( 'alpha' === $facet['type'] ) { |
|
|
|
|
159
|
|
|
$this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
160
|
|
|
} else { |
161
|
|
|
$this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
} |
|
|
|
|
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Enqueue JS and CSS. |
169
|
|
|
*/ |
170
|
|
|
public function assets( $hook ) { |
171
|
|
|
wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true ); |
172
|
|
|
wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER ); |
173
|
|
|
} |
|
|
|
|
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Enable Business Directory Search settings only if LSX Search plugin is enabled. |
177
|
|
|
* |
178
|
|
|
* @return void |
179
|
|
|
*/ |
180
|
|
|
public function configure_settings_search_engine_fields( $cmb ) { |
|
|
|
|
181
|
|
|
$global_args = array( |
182
|
|
|
'title' => __( 'Global', 'lsx-search' ), |
183
|
|
|
'desc' => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ), |
184
|
|
|
); |
185
|
|
|
$this->search_fields( $cmb, 'engine', $global_args ); |
186
|
|
|
} |
|
|
|
|
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Enable Business Directory Search settings only if LSX Search plugin is enabled. |
190
|
|
|
* |
191
|
|
|
* @param object $cmb The CMB2() class. |
192
|
|
|
* @param string $position either top of bottom. |
193
|
|
|
* @return void |
194
|
|
|
*/ |
195
|
|
|
public function configure_settings_search_archive_fields( $cmb ) { |
|
|
|
|
196
|
|
|
$archives = array(); |
197
|
|
|
$post_type_args = array( |
198
|
|
|
'public' => true, |
199
|
|
|
); |
200
|
|
|
$post_types = get_post_types( $post_type_args ); |
201
|
|
|
if ( ! empty( $post_types ) ) { |
|
|
|
|
202
|
|
|
foreach ( $post_types as $post_type_key => $post_type_value ) { |
|
|
|
|
203
|
|
|
switch ( $post_type_key ) { |
|
|
|
|
204
|
|
|
case 'post': |
205
|
|
|
$page_url = home_url(); |
206
|
|
|
$page_title = __( 'Home', 'lsx-search' ); |
207
|
|
|
$show_on_front = get_option( 'show_on_front' ); |
208
|
|
|
if ( 'page' === $show_on_front ) { |
|
|
|
|
209
|
|
|
$page_for_posts = get_option( 'page_for_posts' ); |
210
|
|
|
if ( '' !== $page_for_posts ) { |
|
|
|
|
211
|
|
|
$page_title = get_the_title( $page_for_posts ); |
|
|
|
|
212
|
|
|
$page_url = get_permalink( $page_for_posts ); |
|
|
|
|
213
|
|
|
} |
214
|
|
|
} |
215
|
|
|
$description = sprintf( |
216
|
|
|
/* translators: %s: The subscription info */ |
217
|
|
|
__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
218
|
|
|
$page_url, |
|
|
|
|
219
|
|
|
$page_title |
220
|
|
|
); |
221
|
|
|
$archives[ $post_type_key ] = array( |
222
|
|
|
'title' => __( 'Blog', 'lsx-search' ), |
223
|
|
|
'desc' => $description, |
224
|
|
|
); |
225
|
|
|
break; |
226
|
|
|
|
227
|
|
|
case 'product': |
228
|
|
|
$page_url = home_url(); |
|
|
|
|
229
|
|
|
$page_title = __( 'Shop', 'lsx-search' ); |
|
|
|
|
230
|
|
|
if ( function_exists( 'wc_get_page_id' ) ) { |
|
|
|
|
231
|
|
|
$shop_page = wc_get_page_id( 'shop' ); |
232
|
|
|
$page_url = get_permalink( $shop_page ); |
233
|
|
|
$page_title = get_the_title( $shop_page ); |
234
|
|
|
} |
235
|
|
|
$description = sprintf( |
236
|
|
|
/* translators: %s: The subscription info */ |
237
|
|
|
__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
238
|
|
|
$page_url, |
239
|
|
|
$page_title |
240
|
|
|
); |
241
|
|
|
$archives[ $post_type_key ] = array( |
242
|
|
|
'title' => __( 'Shop', 'lsx-search' ), |
243
|
|
|
'desc' => $description, |
244
|
|
|
); |
245
|
|
|
break; |
246
|
|
|
|
247
|
|
|
default: |
248
|
|
|
if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
|
|
|
249
|
|
|
$temp_post_type = get_post_type_object( $post_type_key ); |
250
|
|
|
if ( ! is_wp_error( $temp_post_type ) ) { |
|
|
|
|
251
|
|
|
$page_url = get_post_type_archive_link( $temp_post_type->name ); |
252
|
|
|
$description = sprintf( |
253
|
|
|
/* translators: %s: The subscription info */ |
254
|
|
|
__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
255
|
|
|
$page_url, |
256
|
|
|
$temp_post_type->label |
257
|
|
|
); |
258
|
|
|
|
259
|
|
|
$archives[ $post_type_key ] = array( |
260
|
|
|
'title' => $temp_post_type->label, |
261
|
|
|
'desc' => $description, |
262
|
|
|
); |
263
|
|
|
} |
264
|
|
|
} |
265
|
|
|
break; |
266
|
|
|
} |
267
|
|
|
} |
268
|
|
|
} |
269
|
|
|
if ( ! empty( $archives ) ) { |
|
|
|
|
270
|
|
|
foreach ( $archives as $archive_key => $archive_args ) { |
|
|
|
|
271
|
|
|
$this->search_fields( $cmb, $archive_key, $archive_args ); |
272
|
|
|
} |
273
|
|
|
} |
274
|
|
|
} |
|
|
|
|
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* Enable Business Directory Search settings only if LSX Search plugin is enabled. |
278
|
|
|
* |
279
|
|
|
* @param object $cmb The CMB2() class. |
280
|
|
|
* @param string $section either engine,archive or single. |
281
|
|
|
* @return void |
282
|
|
|
*/ |
283
|
|
|
public function search_fields( $cmb, $section, $args ) { |
|
|
|
|
284
|
|
|
$this->set_facetwp_vars(); |
285
|
|
|
$cmb->add_field( |
286
|
|
|
array( |
287
|
|
|
'id' => 'settings_' . $section . '_search', |
288
|
|
|
'type' => 'title', |
289
|
|
|
'name' => $args['title'], |
290
|
|
|
'default' => $args['title'], |
291
|
|
|
'description' => $args['desc'], |
292
|
|
|
) |
293
|
|
|
); |
294
|
|
|
do_action( 'lsx_search_settings_section', $cmb, 'top' ); |
295
|
|
|
$cmb->add_field( |
296
|
|
|
array( |
297
|
|
|
'name' => esc_html__( 'Enable Search Filters', 'lsx-search' ), |
298
|
|
|
'id' => $section . '_search_enable', |
299
|
|
|
'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ), |
300
|
|
|
'type' => 'checkbox', |
301
|
|
|
) |
302
|
|
|
); |
303
|
|
|
|
304
|
|
|
$cmb->add_field( |
305
|
|
|
array( |
306
|
|
|
'name' => esc_html__( 'Page Layout', 'lsx-search' ), |
307
|
|
|
'id' => $section . '_search_layout', |
308
|
|
|
'type' => 'select', |
309
|
|
|
'options' => array( |
310
|
|
|
'' => esc_html__( 'Follow the theme layout', 'lsx-search' ), |
311
|
|
|
'2cr' => esc_html__( 'Sidebar on left', 'lsx-search' ), |
312
|
|
|
'2cl' => esc_html__( 'Sidebar on right', 'lsx-search' ), |
313
|
|
|
), |
314
|
|
|
'default' => '', |
315
|
|
|
) |
316
|
|
|
); |
317
|
|
|
|
318
|
|
|
if ( 'product' === $section ) { |
|
|
|
|
319
|
|
|
$cmb->add_field( |
320
|
|
|
array( |
321
|
|
|
'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
322
|
|
|
'id' => $section . '_search_grid_list', |
323
|
|
|
'type' => 'select', |
324
|
|
|
'show_option_none' => false, |
325
|
|
|
'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
326
|
|
|
'options' => array( |
327
|
|
|
'grid' => esc_html__( 'Grid', 'lsx-search' ), |
328
|
|
|
'list' => esc_html__( 'List', 'lsx-search' ), |
329
|
|
|
), |
330
|
|
|
'default' => 'grid', |
|
|
|
|
331
|
|
|
) |
332
|
|
|
); |
333
|
|
|
$cmb->add_field( |
334
|
|
|
array( |
335
|
|
|
'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
336
|
|
|
'id' => $section . '_search_layout_switcher_enable', |
337
|
|
|
'type' => 'checkbox', |
338
|
|
|
'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
339
|
|
|
) |
340
|
|
|
); |
341
|
|
|
} |
342
|
|
|
if ( 'engine' === $section && function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
|
|
|
343
|
|
|
$cmb->add_field( |
344
|
|
|
array( |
345
|
|
|
'name' => esc_html__( 'List layout images', 'lsx-search' ), |
346
|
|
|
'id' => $section . '_search_list_layout_image_style', |
347
|
|
|
'type' => 'select', |
348
|
|
|
'options' => array( |
349
|
|
|
'' => esc_html__( 'Full Height', 'lsx-search' ), |
350
|
|
|
'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
351
|
|
|
), |
352
|
|
|
'default' => '', |
353
|
|
|
) |
354
|
|
|
); |
355
|
|
|
} |
356
|
|
|
if ( 'engine' === $section ) { |
|
|
|
|
357
|
|
|
$cmb->add_field( |
358
|
|
|
array( |
359
|
|
|
'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
360
|
|
|
'id' => $section . '_excerpt_enable', |
361
|
|
|
'type' => 'checkbox', |
362
|
|
|
'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
363
|
|
|
) |
364
|
|
|
); |
365
|
|
|
$cmb->add_field( |
366
|
|
|
array( |
367
|
|
|
'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
368
|
|
|
'id' => $section . '_search_enable_pt_label', |
369
|
|
|
'type' => 'checkbox', |
370
|
|
|
'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
371
|
|
|
) |
372
|
|
|
); |
373
|
|
|
if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
|
|
|
374
|
|
|
$cmb->add_field( |
375
|
|
|
array( |
376
|
|
|
'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
377
|
|
|
'id' => $section . '_search_enable_continent_filter', |
378
|
|
|
'type' => 'checkbox', |
379
|
|
|
'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
380
|
|
|
) |
381
|
|
|
); |
382
|
|
|
$cmb->add_field( |
383
|
|
|
array( |
384
|
|
|
'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
385
|
|
|
'id' => $section . '_search_enable_continental_regions', |
386
|
|
|
'type' => 'checkbox', |
387
|
|
|
'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
388
|
|
|
) |
389
|
|
|
); |
390
|
|
|
} |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
|
|
|
394
|
|
|
$cmb->add_field( |
395
|
|
|
array( |
396
|
|
|
'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
397
|
|
|
'id' => $section . '_search_results_layout', |
398
|
|
|
'type' => 'select', |
399
|
|
|
'options' => array( |
400
|
|
|
'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
|
|
|
401
|
|
|
'list' => esc_html__( 'List only', 'lsx-search' ), |
|
|
|
|
402
|
|
|
), |
403
|
|
|
'default' => '', |
404
|
|
|
) |
405
|
|
|
); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
$cmb->add_field( |
409
|
|
|
array( |
410
|
|
|
'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
411
|
|
|
'id' => $section . '_search_collapse', |
412
|
|
|
'type' => 'checkbox', |
413
|
|
|
'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
414
|
|
|
) |
415
|
|
|
); |
416
|
|
|
|
417
|
|
|
$cmb->add_field( |
418
|
|
|
array( |
419
|
|
|
'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
|
|
|
420
|
|
|
'id' => $section . '_search_disable_sorting', |
|
|
|
|
421
|
|
|
'type' => 'checkbox', |
|
|
|
|
422
|
|
|
'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
423
|
|
|
) |
424
|
|
|
); |
425
|
|
|
|
426
|
|
|
$cmb->add_field( |
427
|
|
|
array( |
428
|
|
|
'name' => esc_html__( 'Disable the Date Sorting Option', 'lsx-search' ), |
429
|
|
|
'id' => $section . '_search_disable_date', |
430
|
|
|
'type' => 'checkbox', |
431
|
|
|
) |
432
|
|
|
); |
433
|
|
|
|
434
|
|
|
$cmb->add_field( |
435
|
|
|
array( |
436
|
|
|
'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
|
|
|
437
|
|
|
'id' => $section . '_search_display_clear_button', |
|
|
|
|
438
|
|
|
'type' => 'checkbox', |
|
|
|
|
439
|
|
|
'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
440
|
|
|
) |
441
|
|
|
); |
442
|
|
|
|
443
|
|
|
$cmb->add_field( |
444
|
|
|
array( |
445
|
|
|
'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
446
|
|
|
'id' => $section . '_search_display_result_count', |
447
|
|
|
'type' => 'checkbox', |
448
|
|
|
) |
449
|
|
|
); |
450
|
|
|
if ( function_exists('is_plugin_active') && is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
|
|
|
451
|
|
|
$cmb->add_field( |
452
|
|
|
array( |
453
|
|
|
'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
454
|
|
|
'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
455
|
|
|
'id' => $section . '_search_az_pagination', |
456
|
|
|
'type' => 'select', |
457
|
|
|
'options' => $this->az_facets, |
458
|
|
|
) |
459
|
|
|
); |
460
|
|
|
} |
461
|
|
|
$cmb->add_field( |
462
|
|
|
array( |
463
|
|
|
'name' => esc_html__( 'Facets', 'lsx-search' ), |
464
|
|
|
'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
465
|
|
|
'id' => $section . '_search_facets', |
466
|
|
|
'type' => 'multicheck', |
467
|
|
|
'options' => $this->facet_data, |
468
|
|
|
) |
469
|
|
|
); |
470
|
|
|
do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
471
|
|
|
$cmb->add_field( |
472
|
|
|
array( |
473
|
|
|
'id' => 'settings_' . $section . '_search_closing', |
474
|
|
|
'type' => 'tab_closing', |
475
|
|
|
) |
476
|
|
|
); |
477
|
|
|
} |
|
|
|
|
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* Handle body colours that might be change by LSX Customiser. |
481
|
|
|
*/ |
482
|
|
|
public function customizer_body_colours_handler( $css, $colors ) { |
|
|
|
|
483
|
|
|
$css .= ' |
484
|
|
|
@import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours"; |
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* LSX Customizer - Body (LSX Search) |
488
|
|
|
*/ |
489
|
|
|
@include customizer-search-body-colours ( |
490
|
|
|
$bg: ' . $colors['background_color'] . ', |
491
|
|
|
$breaker: ' . $colors['body_line_color'] . ', |
492
|
|
|
$color: ' . $colors['body_text_color'] . ', |
493
|
|
|
$link: ' . $colors['body_link_color'] . ', |
494
|
|
|
$hover: ' . $colors['body_link_hover_color'] . ', |
495
|
|
|
$small: ' . $colors['body_text_small_color'] . ' |
496
|
|
|
); |
497
|
|
|
'; |
498
|
|
|
|
499
|
|
|
return $css; |
500
|
|
|
} |
|
|
|
|
501
|
|
|
|
502
|
|
|
/** |
503
|
|
|
* Adds the lsx search buttons to the customizer plugin. |
504
|
|
|
* |
505
|
|
|
* @param string $css |
506
|
|
|
* @param array $colours |
507
|
|
|
* @return string |
508
|
|
|
*/ |
509
|
|
|
public function customizer_button_colours( $css, $colours ) { |
|
|
|
|
510
|
|
|
$css .= ' |
511
|
|
|
#secondary.facetwp-sidebar { |
512
|
|
|
.facetwp-item.facetwp-form { |
513
|
|
|
.search-form { |
514
|
|
|
.btn { |
515
|
|
|
&.search-submit { |
516
|
|
|
@include lsx-button-colour(' . $colours['button_text_color'] . ', ' . $colours['button_text_color_hover'] . ', ' . $colours['button_background_color'] . ', ' . $colours['button_background_hover_color'] . ', ' . $colours['button_shadow'] . '); |
517
|
|
|
} |
518
|
|
|
} |
519
|
|
|
} |
520
|
|
|
} |
521
|
|
|
} |
522
|
|
|
'; |
523
|
|
|
return $css; |
524
|
|
|
} |
|
|
|
|
525
|
|
|
} |
526
|
|
|
|