diff --git a/gin_toolbar.module b/gin_toolbar.module index f30970a..48838bc 100644 --- a/gin_toolbar.module +++ b/gin_toolbar.module @@ -318,20 +318,6 @@ function gin_toolbar_preprocess_navigation(&$variables) { $logo_default = $settings->getDefault('logo.use_default'); $variables['icon_path'] = !$logo_default ? $settings->getDefault('logo.path') : ''; $variables['toolbar_variant'] = $settings->get('classic_toolbar'); - $variables['secondary_toolbar_frontend'] = $settings->get('secondary_toolbar_frontend'); - - if (!$logo_default) { - $variables['icon_path'] = $settings->getDefault('logo.path'); - } -} - -/** - * Implements hook_top_bar(). - */ -function gin_toolbar_preprocess_top_bar(&$variables) { - // Get theme configs. - /** @var \Drupal\gin\GinSettings $settings */ - $settings = \Drupal::classResolver(GinSettings::class); $variables['core_navigation'] = _gin_toolbar_module_is_active('navigation'); $variables['secondary_toolbar_frontend'] = $settings->get('secondary_toolbar_frontend'); $variables['gin_secondary_toolbar'] = [ @@ -345,6 +331,16 @@ function gin_toolbar_preprocess_top_bar(&$variables) { 'id' => 'toolbar-administration-secondary', ], ]; + + if (!$logo_default) { + $variables['icon_path'] = $settings->getDefault('logo.path'); + } +} + +/** + * Implements hook_top_bar(). + */ +function gin_toolbar_preprocess_top_bar(&$variables) { $variables['#attached']['library'][] = 'gin/top_bar'; } diff --git a/templates/navigation.html.twig b/templates/navigation.html.twig index 37fbb73..353d73c 100644 --- a/templates/navigation.html.twig +++ b/templates/navigation.html.twig @@ -4,4 +4,8 @@ * Include navigation.html.twig template from Gin. */ #} +{% if secondary_toolbar_frontend and core_navigation and not is_backend %} + {% include '@gin_toolbar/toolbar--gin--secondary--frontend.html.twig' ignore missing %} +{% endif %} + {% include '@gin/navigation/navigation.html.twig' ignore missing %} diff --git a/templates/top-bar.html.twig b/templates/top-bar.html.twig index 6df5121..51a49f0 100644 --- a/templates/top-bar.html.twig +++ b/templates/top-bar.html.twig @@ -5,7 +5,3 @@ */ #} {% include '@gin/navigation/top-bar--gin.html.twig' ignore missing %} - -{% if secondary_toolbar_frontend %} - {% include '@gin_toolbar/toolbar--gin--secondary--frontend.html.twig' ignore missing %} -{% endif %}