Verified Commit f479374e authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3443810 by SKAUGHT, plopesc, DishaKatariya, finnsky, smustgrave,...

Issue #3443810 by SKAUGHT, plopesc, DishaKatariya, finnsky, smustgrave, ckrina, Prashant.c, larowlan: Custom Navigation logo is disconnected from new Layout template
parent 460a2ddd
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ body {
}
.admin-toolbar__logo img {
  display: block;
  max-width: var(--admin-toolbar-space-40);
}
/**
 * Scroll wrapper for Mobile.
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ body {

  & img {
    display: block;
    max-width: var(--admin-toolbar-space-40);
  }
}

+8 −10
Original line number Diff line number Diff line
@@ -6,14 +6,13 @@
 * Available variables:
 * - content: The content for this layout.
 * - attributes: HTML attributes for the layout <div>.
 * - hide_logo: Whether to hide the logo.
 * - logo_path: The path to the logo image if logo_managed in
 *   navigation.settings configuration has been set.
 * - logo_width: The width of the logo image. Available if
 * - content.settings.hide_logo: Whether to hide the logo.
 * - content.settings.logo_path: The path to the logo image if logo_managed
 *   in navigation.settings configuration has been set.
 * - content.settings.logo_width: The width of the logo image. Available if
 *   logo_path points to a valid image file.
 * - logo_height: The height of the logo image. Available if
 * - content.settings.logo_height: The height of the logo image. Available if
 *   logo_path points to a valid image file.
 *
 * @ingroup themeable
 */
#}
@@ -38,16 +37,15 @@

  <div class="admin-toolbar__scroll-wrapper">
    {% set title_menu = 'admin-toolbar-title'|clean_unique_id %}

    {# @todo - We should get rid of this ID below. #}
    <nav {{ region_attributes.content.setAttribute('id', 'menu-builder').addClass('admin-toolbar__content').setAttribute('aria-labelledby', title_menu) }}>
      <h3 id="{{ title_menu }}" class="visually-hidden">{{ 'Administrative toolbar content'|t }}</h3>
      {# @todo - Needs to be placed here so we can have the header footer on mobile. #}
      <div class="admin-toolbar__header">
        {% if not hide_logo %}
        {% if not content.settings.hide_logo %}
          <a class="admin-toolbar__logo" href="{{ path('<front>') }}">
            {% if logo_path %}
              <img alt="{{ 'Navigation logo'|t }}" src="{{ file_url(logo_path) }}" loading="eager" width="{{ logo_width|default(40) }}" height="{{ logo_height|default(40) }}">
            {% if content.settings.logo_path is not null %}
              <img alt="{{ 'Navigation logo'|t }}" src="{{ content.settings.logo_path }}" loading="eager" width="{{ content.settings.logo_width|default(40) }}" height="{{ content.settings.logo_height|default(40) }}">
            {% else %}
              {% include '@navigation/logo.svg.twig' with {
                label: 'Navigation logo'|t
+0 −7
Original line number Diff line number Diff line
@@ -207,13 +207,6 @@ function navigation_block_alter(&$definitions): void {
  }
}

/**
 * Implements hook_preprocess_HOOK().
 */
function template_preprocess_navigation(array &$variables): void {
  $variables['hide_logo'] = $variables['content']['#hide_logo'] ?? TRUE;
}

/**
 * Implements hook_element_info_alter().
 */
+4 −4
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ public function buildNavigation(array &$page_top): void {
    $asset_url = $module_path . '/assets/fonts/inter-var.woff2';

    $defaults = [
      '#hide_logo' => $logo_provider === self::LOGO_PROVIDER_HIDE,
      'settings' => ['hide_logo' => $logo_provider === self::LOGO_PROVIDER_HIDE],
      '#attached' => [
        'html_head_link' => [
          [
@@ -149,11 +149,11 @@ public function buildNavigation(array &$page_top): void {
        if ($logo_managed instanceof File) {
          $logo_managed_uri = $logo_managed->getFileUri();
          $logo_managed_url = $this->fileUrlGenerator->generateAbsoluteString($logo_managed_uri);
          $page_top['navigation']['#logo_path'] = $logo_managed_url;
          $page_top['navigation'][0]['settings']['logo_path'] = $logo_managed_url;
          $image = $this->imageFactory->get($logo_managed_uri);
          if ($image->isValid()) {
            $page_top['navigation']['#logo_width'] = $image->getWidth();
            $page_top['navigation']['#logo_height'] = $image->getHeight();
            $page_top['navigation'][0]['settings']['logo_width'] = $image->getWidth();
            $page_top['navigation'][0]['settings']['logo_height'] = $image->getHeight();
          }
        }
      }
Loading