Skip to content
Snippets Groups Projects
Commit 64073a1d authored by Si Hobbs's avatar Si Hobbs Committed by Nia Kathoni
Browse files

Issue #3423139: When olivero is the base theme

parent 64724db3
No related branches found
No related tags found
1 merge request!4Check if olivero is base theme.
......@@ -11,8 +11,7 @@ use Drupal\Component\Utility\Html;
* Implements hook_preprocess_HOOK() for views_view_attachment_tabs.
*/
function views_attachment_tabs_olivero_preprocess_views_view_attachment_tabs(array &$variables) {
// Check if we should apply olivero customizations.
if (\Drupal::service('theme.manager')->getActiveTheme()->getName() !== 'olivero') {
if (!_views_attachment_tabs_olivero_theme_is_activated()) {
return;
}
......@@ -85,3 +84,24 @@ function views_attachment_tabs_olivero_preprocess_views_view_attachment_tabs(arr
];
}
}
/**
* Checks if olivero theme is activated or it's a base theme.
*
* @return bool
* True when active, False otherwise.
*/
function _views_attachment_tabs_olivero_theme_is_activated(): bool {
$active_theme = \Drupal::service('theme.manager')->getActiveTheme();
if ($active_theme->getName() === 'olivero') {
return TRUE;
}
foreach ($active_theme->getBaseThemeExtensions() as $base_theme) {
if ($base_theme->getName() === 'olivero') {
return TRUE;
}
}
return FALSE;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment