@@ -12,476 +12,476 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class Admin { |
| 14 | 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 | - '1c' => esc_html__( '1 column', 'lsx-search' ), |
|
| 312 | - '2cr' => esc_html__( '2 columns / Content on right', 'lsx-search' ), |
|
| 313 | - '2cl' => esc_html__( '2 columns / Content on left', 'lsx-search' ), |
|
| 314 | - ), |
|
| 315 | - 'default' => '', |
|
| 316 | - ) |
|
| 317 | - ); |
|
| 318 | - |
|
| 319 | - if ( 'product' === $section ) { |
|
| 320 | - $cmb->add_field( |
|
| 321 | - array( |
|
| 322 | - 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
| 323 | - 'id' => $section . '_search_grid_list', |
|
| 324 | - 'type' => 'select', |
|
| 325 | - 'show_option_none' => false, |
|
| 326 | - 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
| 327 | - 'options' => array( |
|
| 328 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
| 329 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
| 330 | - ), |
|
| 331 | - 'default' => 'grid', |
|
| 332 | - ) |
|
| 333 | - ); |
|
| 334 | - $cmb->add_field( |
|
| 335 | - array( |
|
| 336 | - 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
| 337 | - 'id' => $section . '_search_layout_switcher_enable', |
|
| 338 | - 'type' => 'checkbox', |
|
| 339 | - 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
| 340 | - ) |
|
| 341 | - ); |
|
| 342 | - } |
|
| 343 | - if ( 'engine' === $section && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
| 344 | - $cmb->add_field( |
|
| 345 | - array( |
|
| 346 | - 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
| 347 | - 'id' => $section . '_search_list_layout_image_style', |
|
| 348 | - 'type' => 'select', |
|
| 349 | - 'options' => array( |
|
| 350 | - '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
| 351 | - 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
| 352 | - ), |
|
| 353 | - 'default' => '', |
|
| 354 | - ) |
|
| 355 | - ); |
|
| 356 | - } |
|
| 357 | - if ( 'engine' === $section ) { |
|
| 358 | - $cmb->add_field( |
|
| 359 | - array( |
|
| 360 | - 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
| 361 | - 'id' => $section . '_excerpt_enable', |
|
| 362 | - 'type' => 'checkbox', |
|
| 363 | - 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
| 364 | - ) |
|
| 365 | - ); |
|
| 366 | - $cmb->add_field( |
|
| 367 | - array( |
|
| 368 | - 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
| 369 | - 'id' => $section . '_search_enable_pt_label', |
|
| 370 | - 'type' => 'checkbox', |
|
| 371 | - 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
| 372 | - ) |
|
| 373 | - ); |
|
| 374 | - if ( is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
| 375 | - $cmb->add_field( |
|
| 376 | - array( |
|
| 377 | - 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
| 378 | - 'id' => $section . '_search_enable_continent_filter', |
|
| 379 | - 'type' => 'checkbox', |
|
| 380 | - 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
| 381 | - ) |
|
| 382 | - ); |
|
| 383 | - $cmb->add_field( |
|
| 384 | - array( |
|
| 385 | - 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
| 386 | - 'id' => $section . '_search_enable_continental_regions', |
|
| 387 | - 'type' => 'checkbox', |
|
| 388 | - 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
| 389 | - ) |
|
| 390 | - ); |
|
| 391 | - } |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - if ( is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
| 395 | - $cmb->add_field( |
|
| 396 | - array( |
|
| 397 | - 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
| 398 | - 'id' => $section . '_search_results_layout', |
|
| 399 | - 'type' => 'select', |
|
| 400 | - 'options' => array( |
|
| 401 | - 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
| 402 | - 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
| 403 | - ), |
|
| 404 | - 'default' => '', |
|
| 405 | - ) |
|
| 406 | - ); |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - $cmb->add_field( |
|
| 410 | - array( |
|
| 411 | - 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
| 412 | - 'id' => $section . '_search_collapse', |
|
| 413 | - 'type' => 'checkbox', |
|
| 414 | - 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
| 415 | - ) |
|
| 416 | - ); |
|
| 417 | - |
|
| 418 | - $cmb->add_field( |
|
| 419 | - array( |
|
| 420 | - 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
| 421 | - 'id' => $section . '_search_disable_sorting', |
|
| 422 | - 'type' => 'checkbox', |
|
| 423 | - 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
| 424 | - ) |
|
| 425 | - ); |
|
| 426 | - |
|
| 427 | - $cmb->add_field( |
|
| 428 | - array( |
|
| 429 | - 'name' => esc_html__( 'Disable the Date Option', 'lsx-search' ), |
|
| 430 | - 'id' => $section . '_search_disable_date', |
|
| 431 | - 'type' => 'checkbox', |
|
| 432 | - ) |
|
| 433 | - ); |
|
| 434 | - |
|
| 435 | - $cmb->add_field( |
|
| 436 | - array( |
|
| 437 | - 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
| 438 | - 'id' => $section . '_search_display_clear_button', |
|
| 439 | - 'type' => 'checkbox', |
|
| 440 | - 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
| 441 | - ) |
|
| 442 | - ); |
|
| 443 | - |
|
| 444 | - $cmb->add_field( |
|
| 445 | - array( |
|
| 446 | - 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
| 447 | - 'id' => $section . '_search_display_result_count', |
|
| 448 | - 'type' => 'checkbox', |
|
| 449 | - ) |
|
| 450 | - ); |
|
| 451 | - if ( is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
| 452 | - $cmb->add_field( |
|
| 453 | - array( |
|
| 454 | - 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
| 455 | - 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
| 456 | - 'id' => $section . '_search_az_pagination', |
|
| 457 | - 'type' => 'select', |
|
| 458 | - 'options' => $this->az_facets, |
|
| 459 | - ) |
|
| 460 | - ); |
|
| 461 | - } |
|
| 462 | - $cmb->add_field( |
|
| 463 | - array( |
|
| 464 | - 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
| 465 | - 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
| 466 | - 'id' => $section . '_search_facets', |
|
| 467 | - 'type' => 'multicheck', |
|
| 468 | - 'options' => $this->facet_data, |
|
| 469 | - ) |
|
| 470 | - ); |
|
| 471 | - do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
| 472 | - $cmb->add_field( |
|
| 473 | - array( |
|
| 474 | - 'id' => 'settings_' . $section . '_search_closing', |
|
| 475 | - 'type' => 'tab_closing', |
|
| 476 | - ) |
|
| 477 | - ); |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * Handle body colours that might be change by LSX Customiser. |
|
| 482 | - */ |
|
| 483 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
| 484 | - $css .= ' |
|
| 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 | + '1c' => esc_html__( '1 column', 'lsx-search' ), |
|
| 312 | + '2cr' => esc_html__( '2 columns / Content on right', 'lsx-search' ), |
|
| 313 | + '2cl' => esc_html__( '2 columns / Content on left', 'lsx-search' ), |
|
| 314 | + ), |
|
| 315 | + 'default' => '', |
|
| 316 | + ) |
|
| 317 | + ); |
|
| 318 | + |
|
| 319 | + if ( 'product' === $section ) { |
|
| 320 | + $cmb->add_field( |
|
| 321 | + array( |
|
| 322 | + 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
| 323 | + 'id' => $section . '_search_grid_list', |
|
| 324 | + 'type' => 'select', |
|
| 325 | + 'show_option_none' => false, |
|
| 326 | + 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
| 327 | + 'options' => array( |
|
| 328 | + 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
| 329 | + 'list' => esc_html__( 'List', 'lsx-search' ), |
|
| 330 | + ), |
|
| 331 | + 'default' => 'grid', |
|
| 332 | + ) |
|
| 333 | + ); |
|
| 334 | + $cmb->add_field( |
|
| 335 | + array( |
|
| 336 | + 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
| 337 | + 'id' => $section . '_search_layout_switcher_enable', |
|
| 338 | + 'type' => 'checkbox', |
|
| 339 | + 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
| 340 | + ) |
|
| 341 | + ); |
|
| 342 | + } |
|
| 343 | + if ( 'engine' === $section && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
| 344 | + $cmb->add_field( |
|
| 345 | + array( |
|
| 346 | + 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
| 347 | + 'id' => $section . '_search_list_layout_image_style', |
|
| 348 | + 'type' => 'select', |
|
| 349 | + 'options' => array( |
|
| 350 | + '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
| 351 | + 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
| 352 | + ), |
|
| 353 | + 'default' => '', |
|
| 354 | + ) |
|
| 355 | + ); |
|
| 356 | + } |
|
| 357 | + if ( 'engine' === $section ) { |
|
| 358 | + $cmb->add_field( |
|
| 359 | + array( |
|
| 360 | + 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
| 361 | + 'id' => $section . '_excerpt_enable', |
|
| 362 | + 'type' => 'checkbox', |
|
| 363 | + 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
| 364 | + ) |
|
| 365 | + ); |
|
| 366 | + $cmb->add_field( |
|
| 367 | + array( |
|
| 368 | + 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
| 369 | + 'id' => $section . '_search_enable_pt_label', |
|
| 370 | + 'type' => 'checkbox', |
|
| 371 | + 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
| 372 | + ) |
|
| 373 | + ); |
|
| 374 | + if ( is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
| 375 | + $cmb->add_field( |
|
| 376 | + array( |
|
| 377 | + 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
| 378 | + 'id' => $section . '_search_enable_continent_filter', |
|
| 379 | + 'type' => 'checkbox', |
|
| 380 | + 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
| 381 | + ) |
|
| 382 | + ); |
|
| 383 | + $cmb->add_field( |
|
| 384 | + array( |
|
| 385 | + 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
| 386 | + 'id' => $section . '_search_enable_continental_regions', |
|
| 387 | + 'type' => 'checkbox', |
|
| 388 | + 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
| 389 | + ) |
|
| 390 | + ); |
|
| 391 | + } |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + if ( is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
| 395 | + $cmb->add_field( |
|
| 396 | + array( |
|
| 397 | + 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
| 398 | + 'id' => $section . '_search_results_layout', |
|
| 399 | + 'type' => 'select', |
|
| 400 | + 'options' => array( |
|
| 401 | + 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
| 402 | + 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
| 403 | + ), |
|
| 404 | + 'default' => '', |
|
| 405 | + ) |
|
| 406 | + ); |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + $cmb->add_field( |
|
| 410 | + array( |
|
| 411 | + 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
| 412 | + 'id' => $section . '_search_collapse', |
|
| 413 | + 'type' => 'checkbox', |
|
| 414 | + 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
| 415 | + ) |
|
| 416 | + ); |
|
| 417 | + |
|
| 418 | + $cmb->add_field( |
|
| 419 | + array( |
|
| 420 | + 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
| 421 | + 'id' => $section . '_search_disable_sorting', |
|
| 422 | + 'type' => 'checkbox', |
|
| 423 | + 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
| 424 | + ) |
|
| 425 | + ); |
|
| 426 | + |
|
| 427 | + $cmb->add_field( |
|
| 428 | + array( |
|
| 429 | + 'name' => esc_html__( 'Disable the Date Option', 'lsx-search' ), |
|
| 430 | + 'id' => $section . '_search_disable_date', |
|
| 431 | + 'type' => 'checkbox', |
|
| 432 | + ) |
|
| 433 | + ); |
|
| 434 | + |
|
| 435 | + $cmb->add_field( |
|
| 436 | + array( |
|
| 437 | + 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
| 438 | + 'id' => $section . '_search_display_clear_button', |
|
| 439 | + 'type' => 'checkbox', |
|
| 440 | + 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
| 441 | + ) |
|
| 442 | + ); |
|
| 443 | + |
|
| 444 | + $cmb->add_field( |
|
| 445 | + array( |
|
| 446 | + 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
| 447 | + 'id' => $section . '_search_display_result_count', |
|
| 448 | + 'type' => 'checkbox', |
|
| 449 | + ) |
|
| 450 | + ); |
|
| 451 | + if ( is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
| 452 | + $cmb->add_field( |
|
| 453 | + array( |
|
| 454 | + 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
| 455 | + 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
| 456 | + 'id' => $section . '_search_az_pagination', |
|
| 457 | + 'type' => 'select', |
|
| 458 | + 'options' => $this->az_facets, |
|
| 459 | + ) |
|
| 460 | + ); |
|
| 461 | + } |
|
| 462 | + $cmb->add_field( |
|
| 463 | + array( |
|
| 464 | + 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
| 465 | + 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
| 466 | + 'id' => $section . '_search_facets', |
|
| 467 | + 'type' => 'multicheck', |
|
| 468 | + 'options' => $this->facet_data, |
|
| 469 | + ) |
|
| 470 | + ); |
|
| 471 | + do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
| 472 | + $cmb->add_field( |
|
| 473 | + array( |
|
| 474 | + 'id' => 'settings_' . $section . '_search_closing', |
|
| 475 | + 'type' => 'tab_closing', |
|
| 476 | + ) |
|
| 477 | + ); |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * Handle body colours that might be change by LSX Customiser. |
|
| 482 | + */ |
|
| 483 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
| 484 | + $css .= ' |
|
| 485 | 485 | @import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours"; |
| 486 | 486 | |
| 487 | 487 | /** |
@@ -497,18 +497,18 @@ discard block |
||
| 497 | 497 | ); |
| 498 | 498 | '; |
| 499 | 499 | |
| 500 | - return $css; |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * Adds the lsx search buttons to the customizer plugin. |
|
| 505 | - * |
|
| 506 | - * @param string $css |
|
| 507 | - * @param array $colours |
|
| 508 | - * @return string |
|
| 509 | - */ |
|
| 510 | - public function customizer_button_colours( $css, $colours ) { |
|
| 511 | - $css .= ' |
|
| 500 | + return $css; |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * Adds the lsx search buttons to the customizer plugin. |
|
| 505 | + * |
|
| 506 | + * @param string $css |
|
| 507 | + * @param array $colours |
|
| 508 | + * @return string |
|
| 509 | + */ |
|
| 510 | + public function customizer_button_colours( $css, $colours ) { |
|
| 511 | + $css .= ' |
|
| 512 | 512 | #secondary.facetwp-sidebar { |
| 513 | 513 | .facetwp-item.facetwp-form { |
| 514 | 514 | .search-form { |
@@ -521,6 +521,6 @@ discard block |
||
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | '; |
| 524 | - return $css; |
|
| 525 | - } |
|
| 524 | + return $css; |
|
| 525 | + } |
|
| 526 | 526 | } |