W3cubDocs

/Drupal 8

function system_preprocess_block

system_preprocess_block(&$variables)

Implements hook_preprocess_HOOK() for block templates.

File

core/modules/system/system.module, line 828
Configuration system that lets administrators modify the workings of the site.

Code

function system_preprocess_block(&$variables) {
  switch ($variables['base_plugin_id']) {
    case 'system_branding_block':
      $variables['site_logo'] = '';
      if ($variables['content']['site_logo']['#access'] && $variables['content']['site_logo']['#uri']) {
        $variables['site_logo'] = $variables['content']['site_logo']['#uri'];
      }
      $variables['site_name'] = '';
      if ($variables['content']['site_name']['#access'] && $variables['content']['site_name']['#markup']) {
        $variables['site_name'] = $variables['content']['site_name']['#markup'];
      }
      $variables['site_slogan'] = '';
      if ($variables['content']['site_slogan']['#access'] && $variables['content']['site_slogan']['#markup']) {
        $variables['site_slogan']['#markup'] = $variables['content']['site_slogan']['#markup'];
      }
      break;

    case 'system_powered_by_block':
      $variables['attributes']['role'] = 'complementary';
      break;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!system!system.module/function/system_preprocess_block/8.1.x