diff --git a/core/modules/system/system.module b/core/modules/system/system.module index e74a398..3d0a87a 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1417,6 +1417,15 @@ function system_user_timezone(&$form, &$form_state) { */ function system_preprocess_block(&$variables) { switch ($variables['base_plugin_id']) { + case 'system_branding_block': + $variables['site_logo'] = $variables['content']['site_logo']['#uri']; + $variables['site_name'] = $variables['content']['site_name']; + $variables['site_slogan'] = $variables['content']['site_slogan']; + $variables['use_site_logo'] = $variables['content']['site_logo']['#access']; + $variables['use_site_name'] = $variables['content']['site_name']['#access']; + $variables['use_site_slogan'] = $variables['content']['site_slogan']['#access']; + break; + case 'system_powered_by_block': $variables['attributes']['role'] = 'complementary'; break; diff --git a/core/modules/system/templates/block--system-branding-block.html.twig b/core/modules/system/templates/block--system-branding-block.html.twig index a3ff863..bdf5ada 100644 --- a/core/modules/system/templates/block--system-branding-block.html.twig +++ b/core/modules/system/templates/block--system-branding-block.html.twig @@ -9,32 +9,28 @@ * * Available variables: * - content: The block contents, containing: + * - use_site_logo: Block setting on whether to show the site logo. + * - use_site_name: Block setting on whether to show the site name. + * - use_site_slogan: Block setting on whether to show the site slogan. * - site_logo: Logo for site as defined in Appearance or theme settings. - * Only available if enabled in the block settings. * - site_name: Name for site as defined in Site information settings. - * Only available if enabled in the block settings. * - site_slogan: Slogan for site as defined in Site information settings. - * Only available if enabled in the block settings. * * @ingroup themeable */ #} {% block content %} - {# Workaround for https://drupal.org/node/953034 #} - {% set site_logo %}{{ render_var(content.site_logo) }}{% endset %} - {% set site_name %}{{ render_var(content.site_name) }}{% endset %} - {% set site_slogan %}{{ render_var(content.site_slogan) }}{% endset %} - {% if site_logo %} + {% if use_site_logo and site_logo %} {% endif %} - {% if site_name %} + {% if use_site_name %}
{{ site_name|e }}
{% endif %} - {% if site_slogan %} + {% if use_site_slogan and site_slogan %}
{{ site_slogan }}
{% endif %} {% endblock %} diff --git a/core/themes/bartik/templates/block--system-branding-block.html.twig b/core/themes/bartik/templates/block--system-branding-block.html.twig index af5db5d..b5b4e70 100644 --- a/core/themes/bartik/templates/block--system-branding-block.html.twig +++ b/core/themes/bartik/templates/block--system-branding-block.html.twig @@ -2,41 +2,37 @@ {# /** * @file - * Bartik theme implementation for a branding block. + * Default theme implementation for a branding block. * * Each branding element variable (logo, name, slogan) is only available if * enabled in the block configuration. * * Available variables: * - content: The block contents, containing: + * - use_site_logo: Block setting on whether to show the site logo. + * - use_site_name: Block setting on whether to show the site name. + * - use_site_slogan: Block setting on whether to show the site slogan. * - site_logo: Logo for site as defined in Appearance or theme settings. - * Only available if enabled in the block settings. * - site_name: Name for site as defined in Site information settings. - * Only available if enabled in the block settings. * - site_slogan: Slogan for site as defined in Site information settings. - * Only available if enabled in the block settings. * * @ingroup themeable */ #} {% block content %} - {# Workaround for https://drupal.org/node/953034 #} - {% set site_logo %}{{ render_var(content.site_logo) }}{% endset %} - {% set site_name %}{{ render_var(content.site_name) }}{% endset %} - {% set site_slogan %}{{ render_var(content.site_slogan) }}{% endset %} - {% if site_logo %} + {% if use_site_logo and site_logo %} {% endif %} - {% if site_name or slogan %} + {% if use_site_name or (use_site_slogan and site_slogan) %}
- {% if site_name %} + {% if use_site_name %} {{ site_name|e }} {% endif %} - {% if site_slogan %} + {% if use_site_slogan and site_slogan %}
{{ site_slogan }}
{% endif %}