Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. system.module

function system_preprocess_block

Implements hook_preprocess_HOOK() for block templates.

Related topics

Authorized operations
Functions to run operations with elevated privileges via authorize.php.

File

core/modules/system/system.module, line 308

Code

function system_preprocess_block(&$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;
    }
}
RSS feed
Powered by Drupal