diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php index 54ac5dc..b6a491a 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php @@ -174,19 +174,26 @@ public function blockSubmit($form, &$form_state) { * {@inheritdoc} */ public function build() { - $build = array(); $site_config = $this->configFactory->get('system.site'); - $build['#theme'] = 'block__system_branding'; - $build['#use_site_logo'] = $this->configuration['use_site_logo']; - $build['#site_logo'] = theme_get_setting('logo'); + $logo = theme_get_setting('logo'); + $build['site_logo'] = array( + '#theme' => 'image', + '#uri' => $logo['url'], + '#alt' => t('Home'), + '#access' => $this->configuration['use_site_logo'], + ); - $build['#use_site_name'] = $this->configuration['use_site_name']; - $build['#site_name'] = $site_config->get('name'); + $build['site_name'] = array( + '#markup' => $site_config->get('name'), + '#access' => $this->configuration['use_site_name'], + ); - $build['#use_site_slogan'] = $this->configuration['use_site_slogan']; - $build['#site_slogan'] = Xss::filterAdmin($site_config->get('slogan')); + $build['site_slogan'] = array( + '#markup' => Xss::filterAdmin($site_config->get('slogan')), + '#access' => $this->configuration['use_site_slogan'], + ); return $build; } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 8e373b6..572670f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -152,17 +152,9 @@ function system_help($path, $arg) { */ function system_theme() { return array_merge(drupal_common_theme(), array( - 'block__system_branding' => array( - 'variables' => array( - 'use_site_logo' => FALSE, - 'site_logo' => array(), - 'use_site_name' => FALSE, - 'site_name' => '', - 'use_site_slogan' => FALSE, - 'site_slogan' => '', - ), - 'base-hook' => 'block', - 'template' => 'block--system-branding', + 'block__system_branding_block' => array( + 'base hook' => 'block', + 'template' => 'block--system-branding-block', ), 'system_themes_page' => array( 'variables' => array( diff --git a/core/modules/system/templates/block--system-branding.html.twig b/core/modules/system/templates/block--system-branding-block.html.twig similarity index 35% rename from core/modules/system/templates/block--system-branding.html.twig rename to core/modules/system/templates/block--system-branding-block.html.twig index 3351634..2b8879b 100644 --- a/core/modules/system/templates/block--system-branding.html.twig +++ b/core/modules/system/templates/block--system-branding-block.html.twig @@ -4,29 +4,35 @@ * @file * 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: - * - 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. - * - site_name: Name for site as defined in Site information settings. - * - site_slogan: Slogan for site as defined in Site information settings. + * - content: The block contents, containing: + * - 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. + * - site_slogan: Slogan for site as defined in Site information settings. * * @ingroup themeable */ #} {% block content %} - {% if use_site_logo and site_logo %} + {# Workaround for https://drupal.org/node/953034 #} + {% set logo %}{{ render_var(content.site_logo) }}{% endset %} + {% set site_name %}{{ render_var(content.site_name) }}{% endset %} + {% set slogan %}{{ render_var(content.site_slogan) }}{% endset %} + {% if logo %} {% endif %} - {% if use_site_name %} + {% if site_name %}
{{ site_name|e }}
{% endif %} - {% if use_site_slogan and site_slogan %} -
{{ site_slogan }}
+ {% if slogan %} +
{{ slogan }}
{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/core/themes/bartik/templates/block--system-branding.html.twig b/core/themes/bartik/templates/block--system-branding-block.html.twig similarity index 34% rename from core/themes/bartik/templates/block--system-branding.html.twig rename to core/themes/bartik/templates/block--system-branding-block.html.twig index 4e467ed..b1a5313 100644 --- a/core/themes/bartik/templates/block--system-branding.html.twig +++ b/core/themes/bartik/templates/block--system-branding-block.html.twig @@ -1,33 +1,42 @@ +{% extends "@block/block.html.twig" %} {# /** * @file * Bartik theme implementation for a branding block. * + * Each branding element variable (logo, name, slogan) is only available if + * enabled in the block configuration. + * * Available variables: - * - 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. - * - site_name: Name for site as defined in Site information settings. - * - site_slogan: Slogan for site as defined in Site information settings. + * - content: The block contents, containing: + * - 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. + * - site_slogan: Slogan for site as defined in Site information settings. * * @ingroup themeable */ #} - {% if use_site_logo and site_logo %} +{% block content %} + {# Workaround for https://drupal.org/node/953034 #} + {% set logo %}{{ render_var(content.site_logo) }}{% endset %} + {% set site_name %}{{ render_var(content.site_name) }}{% endset %} + {% set slogan %}{{ render_var(content.site_slogan) }}{% endset %} + {% if logo %} {% endif %} - {% if use_site_name or (use_site_slogan and site_slogan) %} + {% if site_name or slogan %}
- {% if use_site_name %} + {% if site_name %} {{ site_name|e }} {% endif %} - {% if use_site_slogan and site_slogan %} -
{{ site_slogan }}
+ {% if slogan %} +
{{ slogan }}
{% endif %}
{% endif %} +{% endblock %}