function SystemThemeHooks::preprocessBlock
Implements hook_preprocess_HOOK() for block templates.
Attributes
#[Hook('preprocess_block')]
File
-
core/
modules/ system/ src/ Hook/ SystemThemeHooks.php, line 98
Class
- SystemThemeHooks
- Hook implementations for system.
Namespace
Drupal\system\HookCode
public function preprocessBlock(&$variables) : void {
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.