diff --git a/themes/bs_bootstrap/bs_bootstrap.theme b/themes/bs_bootstrap/bs_bootstrap.theme index b6248f7..492f10c 100644 --- a/themes/bs_bootstrap/bs_bootstrap.theme +++ b/themes/bs_bootstrap/bs_bootstrap.theme @@ -161,6 +161,17 @@ function bs_bootstrap_form_system_theme_settings_alter(&$form, FormStateInterfac '#description' => t('Second level dropdown option will show secondary level in dropdown control. Second level horizontal will render second level menu items in horizontal bar beneath first level. With horizontal type third level will be shown in dropdown control.'), ]; + $form['bs_bootstrap']['navbar']['onhover'] = [ + '#type' => 'select', + '#title' => t('Navbar show sub-level on hover'), + '#options' => [ + 1 => t('On'), + 0 => t('Off'), + ], + '#default_value' => bs_bootstrap_get_setting('navbar.onhover') ? 1 : 0, + '#description' => t('Open sub-level navigation on mouse hover. This option will work when Navbar type option is Second level horizontal.'), + ]; + $navbar_offcanvas_type = bs_bootstrap_get_setting('navbar_offcanvas.type'); $form['bs_bootstrap']['navbar_offcanvas']['type'] = [ '#type' => 'select', @@ -182,16 +193,6 @@ function bs_bootstrap_form_system_theme_settings_alter(&$form, FormStateInterfac '#description' => t('When responsive navigation is offcanvas where should it be positioned. This is experimental option. Position left is not fully tested for now.'), ]; - $form['bs_bootstrap']['navbar']['onhover'] = [ - '#type' => 'select', - '#title' => t('Navbar show sub-level on hover'), - '#options' => [ - 'on' => t('On'), - 'off' => t('Off'), - ], - '#default_value' => bs_bootstrap_get_setting('navbar.onhover') ? 'on' : 'off', - '#description' => t('Open sub-level navigation on mouse hover. This option will work when Navbar type option is Second level horizontal.'), - ]; // Language switcher block. $form['bs_bootstrap']['language_block']['type'] = [ '#type' => 'select', @@ -233,8 +234,6 @@ function bs_bootstrap_form_system_theme_settings_submit(&$form, FormStateInterfa $form_state->setValue(['bs_bootstrap', 'navbar_offcanvas'], $navbar_offcanvas); } - $form_state->setValue(['bs_bootstrap', 'navbar' , 'onhover'], $form_state->getValue(['bs_bootstrap', 'navbar', 'onhover']) === "on" ? TRUE : FALSE); - $form_state->setValue(['bs_bootstrap', 'custom_forms'], $form_state->getValue(['bs_bootstrap', 'custom_forms']) === "1" ? TRUE : FALSE); } @@ -375,7 +374,7 @@ function bs_bootstrap_get_setting($setting_name) { ]; $setting_value = theme_get_setting('bs_bootstrap.' . $setting_name); - if ($setting_value) { + if (isset($setting_value)) { return $setting_value; } diff --git a/themes/bs_bootstrap/config/schema/bs_bootstrap.schema.yml b/themes/bs_bootstrap/config/schema/bs_bootstrap.schema.yml index d2389eb..7c345c5 100644 --- a/themes/bs_bootstrap/config/schema/bs_bootstrap.schema.yml +++ b/themes/bs_bootstrap/config/schema/bs_bootstrap.schema.yml @@ -4,3 +4,12 @@ bs_bootstrap.settings: type: theme_settings label: 'BS Bootstrap settings' + bs_bootstrap: + type: mapping + mapping: + navbar: + type: mapping + mapping: + onhover: + type: boolean + label: 'Show secondary level menu on hover'