From b3eed5d76afe5c7fa5ce020243372fc2efdaaab6 Mon Sep 17 00:00:00 2001 From: sacarney Date: Wed, 20 Apr 2022 15:41:37 -0500 Subject: [PATCH 1/6] D8ISUTHEME-180 Add is_front or not_front class to body --- templates/layout/html.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/layout/html.html.twig b/templates/layout/html.html.twig index 858e2f3..d56d485 100644 --- a/templates/layout/html.html.twig +++ b/templates/layout/html.html.twig @@ -38,6 +38,7 @@ is_node_edit == 'edit' ? 'node-form node-form_' ~ 'edit', is_node_add == 'add' ? 'node-form node-form_' ~ 'add', is_node_delete == 'delete' ? 'node-form node-form_' ~ 'delete', + is_front ? 'is_front' : 'not_front', ] %} From 871fb1ad969e6cee4f87197a540089463c65c914 Mon Sep 17 00:00:00 2001 From: sacarney Date: Wed, 20 Apr 2022 15:42:03 -0500 Subject: [PATCH 2/6] D8ISUTHEME-180 Add views classes to body --- iastate_theme.theme | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iastate_theme.theme b/iastate_theme.theme index aa1e972..166acd0 100644 --- a/iastate_theme.theme +++ b/iastate_theme.theme @@ -6,9 +6,10 @@ use Drupal\Core\Form\FormStateInterface; /** * Implements template_preprocess_html(). * - * Add node-id_{id} class. */ function iastate_theme_preprocess_html(&$variables) { + + /* Add node-id_ and node-type_ classes to body */ $node = \Drupal::request()->attributes->get('node'); if ($node instanceof NodeInterface) { $variables['attributes']['class'][] = 'node-id_' . $node->id(); @@ -16,6 +17,16 @@ function iastate_theme_preprocess_html(&$variables) { if (isset($variables['node_type'])) { $variables['attributes']['class'][] = 'node-type_' . $variables['node_type']; } + + /* Add views classes to body */ + $route = \Drupal::routeMatch()->getRouteObject(); + $view_id = $route->getDefault('view_id'); + $display_id = $route->getDefault('display_id'); + + if ($view_id) { + $variables['attributes']['class'][] = 'view_' . $view_id; + $variables['attributes']['class'][] = 'view-display_' . $display_id; + } } /* From 36ee3b1c1bed22b2dae3f44b4698f14e8814a655 Mon Sep 17 00:00:00 2001 From: sacarney Date: Mon, 25 Apr 2022 15:37:37 -0500 Subject: [PATCH 3/6] D8ISUTHEME-182 Declare new theme regions --- iastate_theme.info.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iastate_theme.info.yml b/iastate_theme.info.yml index 7bfe230..00bc25c 100644 --- a/iastate_theme.info.yml +++ b/iastate_theme.info.yml @@ -26,9 +26,11 @@ regions: menu_navbar: 'Menu Navbar' post_nav: 'Post Nav' breadcrumbs: 'Breadcrumbs' + hero_top: 'Hero Top' content: 'Page Content' sidebar_first: 'Sidebar First' sidebar_second: 'Sidebar Second' + hero_bottom: 'Hero Bottom' footer_first: 'Footer First' footer_second: 'Footer Second' footer_third: 'Footer Third' From 38d37c064af558d0b2bcdb579bb6ef9feaf948de Mon Sep 17 00:00:00 2001 From: sacarney Date: Mon, 25 Apr 2022 15:37:55 -0500 Subject: [PATCH 4/6] D8ISUTHEME-182 Put new regions into template --- templates/layout/page.html.twig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/layout/page.html.twig b/templates/layout/page.html.twig index 4c45f8f..f62ee80 100644 --- a/templates/layout/page.html.twig +++ b/templates/layout/page.html.twig @@ -79,6 +79,10 @@ {{ page.breadcrumbs }} + {% if page.hero_top %} + {{ page.hero_top }} + {% endif %} +
@@ -117,6 +121,10 @@
+ {% if page.hero_bottom %} + {{ page.hero_bottom }} + {% endif %} + {% include '@iastate_theme/parts/footer.html.twig' %} From bc5115857c28a921e71c28cf36da1398cf933ae3 Mon Sep 17 00:00:00 2001 From: sacarney Date: Wed, 27 Apr 2022 15:48:54 -0500 Subject: [PATCH 5/6] D8ISUTHEME-183 Add block type class to content blocks --- iastate_theme.theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iastate_theme.theme b/iastate_theme.theme index 166acd0..d85ab4f 100644 --- a/iastate_theme.theme +++ b/iastate_theme.theme @@ -171,16 +171,22 @@ function iastate_theme_preprocess(&$variables, $hook) { /* * Implements theme_preprocess_block(). * - * Make theme settings available in block templates */ function iastate_theme_preprocess_block(&$variables) { + // Make theme settings available in block templates $variables['iastate_logo_alt'] = theme_get_setting('iastate_logo_alt'); $variables['iastate_logo_width'] = theme_get_setting('iastate_logo_width'); $variables['iastate_logo_height'] = theme_get_setting('iastate_logo_height'); $variables['iastate_logo_alt'] = theme_get_setting('iastate_logo_alt'); $variables['is_default_logo'] = \Drupal::config('iastate_theme.settings')->get('logo.use_default'); $variables['iastate_logo_url'] = theme_get_setting('iastate_logo_url'); + + // Make block type available in block templates + if ($variables['elements']['#base_plugin_id'] == 'block_content') { + $blockType = strtr($variables['content']['#block_content']->bundle(), '_', '-'); + $variables['attributes']['class'][] = 'block-type_' . $blockType; + } } /* From 79d59d0147e410201c874110cf2faf4c02f547bf Mon Sep 17 00:00:00 2001 From: sacarney Date: Wed, 4 May 2022 09:36:03 -0500 Subject: [PATCH 6/6] Update version number --- iastate_theme.info.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iastate_theme.info.yml b/iastate_theme.info.yml index 00bc25c..a7aae13 100644 --- a/iastate_theme.info.yml +++ b/iastate_theme.info.yml @@ -3,7 +3,7 @@ description: Drupal 9 theme for Iowa State University websites type: theme core: 8.x core_version_requirement: ^8 || ^9 -version: "1.7.4" +version: "1.7.5" base theme: stable libraries: - iastate_theme/global-css