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

Issue #3516558 by plopesc, smustgrave, m4olivei, nod_, cb_govcms, tarawij,...

Issue #3516558 by plopesc, smustgrave, m4olivei, nod_, cb_govcms, tarawij, pdureau: Settings is not a valid render array in navigation module

(cherry picked from commit 34f55547)
parent 0cf21013
Loading
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -6,12 +6,13 @@
 * Available variables:
 * - content: The content for this layout.
 * - attributes: HTML attributes for the layout <div>.
 * - content.settings.hide_logo: Whether to hide the logo.
 * - content.settings.logo_path: The path to the logo image if logo_managed
 * - settings: layout settings. The following are related to the logo:
 *   - 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.
 * - content.settings.logo_width: The width of the logo image. Available if
 *   - logo_width: The width of the logo image. Available if
 *     logo_path points to a valid image file.
 * - content.settings.logo_height: The height of the logo image. Available if
 *   - settings.logo_height: The height of the logo image. Available if
 *     logo_path points to a valid image file.
 * @ingroup themeable
 */
@@ -45,10 +46,10 @@
      <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 content.settings.hide_logo %}
        {% if not settings.hide_logo %}
          <a class="admin-toolbar__logo" href="{{ path('<front>') }}">
            {% 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) }}">
            {% if settings.logo_path is not null %}
              <img alt="{{ 'Navigation logo'|t }}" src="{{ settings.logo_path }}" loading="eager" width="{{ settings.logo_width|default(40) }}" height="{{ settings.logo_height|default(40) }}">
            {% else %}
              {% include '@navigation/logo.svg.twig' with {
                label: 'Navigation logo'|t
+4 −4
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public function buildNavigation(array &$page_top): void {
    $asset_url = $module_path . '/assets/fonts/inter-var.woff2';

    $defaults = [
      'settings' => ['hide_logo' => $logo_provider === self::LOGO_PROVIDER_HIDE],
      '#settings' => ['hide_logo' => $logo_provider === self::LOGO_PROVIDER_HIDE],
      '#attached' => [
        'html_head_link' => [
          [
@@ -151,10 +151,10 @@ public function buildNavigation(array &$page_top): void {
      if (!empty($logo_path) && is_file($logo_path)) {
        $logo_managed_url = $this->fileUrlGenerator->generateAbsoluteString($logo_path);
        $image = $this->imageFactory->get($logo_path);
        $page_top['navigation'][0]['settings']['logo_path'] = $logo_managed_url;
        $page_top['navigation'][0]['#settings']['logo_path'] = $logo_managed_url;
        if ($image->isValid()) {
          $page_top['navigation'][0]['settings']['logo_width'] = $image->getWidth();
          $page_top['navigation'][0]['settings']['logo_height'] = $image->getHeight();
          $page_top['navigation'][0]['#settings']['logo_width'] = $image->getWidth();
          $page_top['navigation'][0]['#settings']['logo_height'] = $image->getHeight();
        }
      }
    }