diff --git a/bulma.theme b/bulma.theme index 3344c51..bbcfd11 100644 --- a/bulma.theme +++ b/bulma.theme @@ -171,7 +171,9 @@ function bulma_preprocess_block(&$variables) { // Customize the ID and classes of the main menu block. $main_menu = Bulma::singleSetting('bulma_general_menu'); - if (!empty($variables['elements']['#id']) && $variables['elements']['#id'] === 'bulma_' . $main_menu . '_menu') { + $plugin_id = 'system_menu_block:' . $main_menu; + // Match blocks by plugin ID to support Bulma and any active subtheme. + if (!empty($variables['elements']['#plugin_id']) && $variables['elements']['#plugin_id'] == $plugin_id) { $variables['attributes']['id'] = 'nav-menu'; $variables['attributes']['class'][] = 'nav-menu'; $variables['attributes']['class'][] = 'nav-right'; @@ -380,7 +382,7 @@ function bulma_library_info_alter(&$libraries, $extension) { if ($extension === 'bulma' && isset($libraries['global']) && ($themes = Bulmaswatch::getThemes()) && - (($theme = theme_get_setting('bulma_bulmaswatch_theme')) !== 'default') + (($theme = Bulma::singleSetting('bulma_bulmaswatch_theme')) !== 'default') ) { $libraries['global']['css']['base'] = [ $themes[$theme]['local_css'] => ['minified' => TRUE], diff --git a/starterkit/default/README.md b/starterkit/default/README.md index 534760f..7037986 100644 --- a/starterkit/default/README.md +++ b/starterkit/default/README.md @@ -6,6 +6,12 @@ It has Bulma CSS framework, Sass, and Font Awesome built-in. 1. Components and plugins from Bulma. 2. Sass and Font Awesome built-in. +## Installation +After installing, you can optionally add the +[Bulmaswath](https://jenil.github.io/bulmaswatch) themes. To do so, +[download from GitHub](https://github.com/jenil/bulmaswatch) and extract to +libraries/bulmaswatch, renaming the extracted directory as necessary. + ## Links * Project Page: http://vallic.com * Documentation: http://vallic.com diff --git a/starterkit/default/config/install/default.settings.yml b/starterkit/default/config/install/default.settings.yml index 5c45498..513eced 100644 --- a/starterkit/default/config/install/default.settings.yml +++ b/starterkit/default/config/install/default.settings.yml @@ -23,3 +23,5 @@ bulma_table: bulma_table_bordered: 0 bulma_table_striped: 0 bulma_table_narrow: 0 +bulma_bulmaswatch: + bulma_bulmaswatch_theme: 'default' diff --git a/starterkit/default/config/schema/default.schema.yml b/starterkit/default/config/schema/default.schema.yml index 0d929bf..62224b7 100644 --- a/starterkit/default/config/schema/default.schema.yml +++ b/starterkit/default/config/schema/default.schema.yml @@ -84,3 +84,10 @@ BULMA_SUBTHEME_MACHINE_NAME.settings: bulma_table_narrow: type: integer label: 'Narrow' + bulma_bulmaswatch: + type: mapping + label: 'Bulmaswatch' + mapping: + bulma_bulmaswatch_theme: + type: string + label: 'Theme' diff --git a/starterkit/default/default.theme b/starterkit/default/default.theme index 2377a76..b2dd9ca 100644 --- a/starterkit/default/default.theme +++ b/starterkit/default/default.theme @@ -4,3 +4,20 @@ * @file * Theme functions. */ + +/** + * Implements hook_library_info_alter(). + */ +function BULMA_SUBTHEME_MACHINE_NAME_library_info_alter(&$libraries, $extension) { + // Swap in Bulmaswatch theme's css. + if ($extension === 'BULMA_SUBTHEME_MACHINE_NAME' && + isset($libraries['global']) && + ($themes = Bulmaswatch::getThemes()) && + (($theme = Bulma::singleSetting('bulma_bulmaswatch_theme')) !== 'default') + ) { + $libraries['global']['css']['base'] = [ + $themes[$theme]['local_css'] => ['minified' => TRUE], + ]; + } + +} diff --git a/starterkit/default/templates/system/default.html.twig b/starterkit/default/templates/system/default.html.twig index 20ce71a..db4abbf 100644 --- a/starterkit/default/templates/system/default.html.twig +++ b/starterkit/default/templates/system/default.html.twig @@ -45,120 +45,118 @@ * @ingroup themeable */ #} -