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 b6a491a..43e5026 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemBrandingBlock.php @@ -111,18 +111,21 @@ public function blockForm($form, &$form_state) { $appearance_url = $this->urlGenerator->generateFromRoute('system.themes_page'); $theme_settings_url = $this->urlGenerator->generateFromRoute('system.theme_settings_theme', array('theme' => $theme)); - // Provide links to the Appearance and Theme Settings pages if user has access to administer themes. + // Provide links to the Appearance and Theme Settings pages + // if user has access to administer themes. $site_logo_description = $this->t('Defined on the Appearance or Theme Settings page.', array('@appearance' => $appearance_url, '@theme' => $theme_settings_url)); } else { - // Explain that user does not have access to the Appearance and Theme Settings pages. + // Explain that user does not have access + // to the Appearance and Theme Settings pages. $site_logo_description = $this->t('Defined on the Appearance or Theme Settings page. You do not have the appropriate permissions to change the site logo.'); } if ($administer_site_configuration_access) { // Get paths to settings pages. $site_information_url = $this->urlGenerator->generateFromRoute('system.site_information_settings'); - // Provide link to Site Information page if user has access to administer site configuration. + // Provide link to Site Information page + // if user has access to administer site configuration. $site_name_description = $this->t('Defined on the Site Information page.', array('@information' => $site_information_url)); $site_slogan_description = $this->t('Defined on the Site Information page.', array('@information' => $site_information_url)); } @@ -133,11 +136,9 @@ public function blockForm($form, &$form_state) { } $form['block_branding'] = array( - '#type' => 'details', + '#type' => 'fieldset', '#title' => $this->t('Toggle branding elements'), '#description' => $this->t('Choose which branding elements you want to show in this block instance.'), - '#collapsed' => FALSE, - '#collapsible' => FALSE, ); $form['block_branding']['use_site_logo'] = array( '#type' => 'checkbox', diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 64dba1a..844e38b 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1421,12 +1421,18 @@ 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']; + $variables['site_logo'] = ''; + if ($variables['content']['site_logo']['#access'] == 1 && $variables['content']['site_logo']['#uri']) { + $variables['site_logo'] = $variables['content']['site_logo']['#uri']; + } + $variables['site_name'] = ''; + if ($variables['content']['site_name']['#access'] == 1 && $variables['content']['site_name']['#markup']) { + $variables['site_name'] = $variables['content']['site_name']['#markup']; + } + $variables['site_slogan'] = ''; + if ($variables['content']['site_slogan']['#access'] == 1 && $variables['content']['site_slogan']['#markup']) { + $variables['site_slogan'] = $variables['content']['site_slogan']['#markup']; + } break; case 'system_powered_by_block': 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 bdf5ada..2a12c7a 100644 --- a/core/modules/system/templates/block--system-branding-block.html.twig +++ b/core/modules/system/templates/block--system-branding-block.html.twig @@ -8,29 +8,25 @@ * 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. - * - site_name: Name for site as defined in Site information settings. - * - site_slogan: Slogan for site as defined in Site information settings. + * - 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. * * @ingroup themeable */ #} {% block content %} - {% if use_site_logo and site_logo %} + {% if site_logo %} {% endif %} - {% if use_site_name %} + {% if site_name %}
{{ site_name|e }}
{% endif %} - {% if use_site_slogan and site_slogan %} + {% if 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 b5b4e70..5451919 100644 --- a/core/themes/bartik/templates/block--system-branding-block.html.twig +++ b/core/themes/bartik/templates/block--system-branding-block.html.twig @@ -8,31 +8,27 @@ * 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. - * - site_name: Name for site as defined in Site information settings. - * - site_slogan: Slogan for site as defined in Site information settings. + * - 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. * * @ingroup themeable */ #} {% block content %} - {% if use_site_logo and site_logo %} + {% if site_logo %} {% endif %} - {% if use_site_name or (use_site_slogan and site_slogan) %} + {% if site_name or site_slogan %}
- {% if use_site_name %} + {% if site_name %} {{ site_name|e }} {% endif %} - {% if use_site_slogan and site_slogan %} + {% if site_slogan %}
{{ site_slogan }}
{% endif %}