From 3e352adf986babfdb26d18c2dcd081c716307fbd Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Thu, 10 Oct 2019 09:09:06 +0700 Subject: [PATCH] Fix search form on/off settings. --- inc/admin/settings/property.php | 60 ++++++++++++------------ inc/property/class-opalestate-search.php | 14 +++--- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php index 81ce2362..93cb14df 100755 --- a/inc/admin/settings/property.php +++ b/inc/admin/settings/property.php @@ -261,36 +261,36 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab { ]; } - $fields[] = [ - 'name' => esc_html__( 'Vertical Search Fields', 'opalestate-pro' ), - 'type' => 'opalestate_title', - 'id' => 'opalestate_title_general_settings_2', - 'before_row' => '
', - 'after_row' => '
', - ]; - - $fields[] = [ - 'name' => esc_html__( 'Show Price', 'opalestate-pro' ), - 'id' => OPALESTATE_PROPERTY_PREFIX . 'price_opt_v', - 'type' => 'switch', - 'options' => [ - 0 => esc_html__( 'Disable', 'opalestate-pro' ), - 1 => esc_html__( 'Enable', 'opalestate-pro' ), - ], - ]; - - foreach ( $metas as $key => $meta ) { - $fields[] = [ - 'name' => $meta['name'], - 'id' => $meta['id'] . '_opt_v', - 'type' => 'switch', - 'options' => [ - 0 => esc_html__( 'Disable', 'opalestate-pro' ), - 1 => esc_html__( 'Enable', 'opalestate-pro' ), - ], - - ]; - } + // $fields[] = [ + // 'name' => esc_html__( 'Vertical Search Fields', 'opalestate-pro' ), + // 'type' => 'opalestate_title', + // 'id' => 'opalestate_title_general_settings_2', + // 'before_row' => '
', + // 'after_row' => '
', + // ]; + // + // $fields[] = [ + // 'name' => esc_html__( 'Show Price', 'opalestate-pro' ), + // 'id' => OPALESTATE_PROPERTY_PREFIX . 'price_opt_v', + // 'type' => 'switch', + // 'options' => [ + // 0 => esc_html__( 'Disable', 'opalestate-pro' ), + // 1 => esc_html__( 'Enable', 'opalestate-pro' ), + // ], + // ]; + // + // foreach ( $metas as $key => $meta ) { + // $fields[] = [ + // 'name' => $meta['name'], + // 'id' => $meta['id'] . '_opt_v', + // 'type' => 'switch', + // 'options' => [ + // 0 => esc_html__( 'Disable', 'opalestate-pro' ), + // 1 => esc_html__( 'Enable', 'opalestate-pro' ), + // ], + // + // ]; + // } } return $fields; diff --git a/inc/property/class-opalestate-search.php b/inc/property/class-opalestate-search.php index bbc4fd25..fad2417a 100755 --- a/inc/property/class-opalestate-search.php +++ b/inc/property/class-opalestate-search.php @@ -394,18 +394,17 @@ class OpalEstate_Search { } /** - * + * Get_setting_search_fields. */ public static function get_setting_search_fields( $option = '' ) { - $options = [ + $default = apply_filters( 'opalestate_default_fields_setting', [ OPALESTATE_PROPERTY_PREFIX . 'bedrooms' => esc_html__( 'Bed Rooms', 'opalestate-pro' ), OPALESTATE_PROPERTY_PREFIX . 'parking' => esc_html__( 'Parking', 'opalestate-pro' ), OPALESTATE_PROPERTY_PREFIX . 'bathrooms' => esc_html__( 'Bath Rooms', 'opalestate-pro' ), - ]; + ] ); - $default = apply_filters( 'opalestate_default_fields_setting', $options ); + $metas = Opalestate_Property_MetaBox::metaboxes_info_fields(); - $metas = Opalestate_Property_MetaBox::metaboxes_info_fields(); $esettings = []; $found = false; foreach ( $metas as $key => $meta ) { @@ -415,10 +414,11 @@ class OpalEstate_Search { continue; } - if ( $value ) { - $id = str_replace( OPALESTATE_PROPERTY_PREFIX, "", $meta['id'] ); + if ( 'on' == $value ) { + $id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $meta['id'] ); $esettings[ $id ] = $meta['name']; } + if ( $value == 0 ) { $found = true; }