You are here

function system_preprocess_block in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/system.module \system_preprocess_block()
  2. 7 modules/system/system.module \system_preprocess_block()

Implements hook_preprocess_HOOK() for block templates.

File

core/modules/system/system.module, line 794
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;
  }
}