color_block_view_pre_render(array $build)
#pre_render callback: Sets color preset logo.
File
- core/modules/color/color.module, line 120
- Allows users to change the color scheme of themes.
Code
function color_block_view_pre_render(array $build) { $theme_key = \Drupal::theme()->getActiveTheme()->getName(); $config = \Drupal::config('color.theme.' . $theme_key); CacheableMetadata::createFromRenderArray($build) ->addCacheableDependency($config) ->applyTo($build); // Override logo. $logo = $config->get('logo'); if ($logo && $build['content']['site_logo'] && preg_match('!' . $theme_key . '/logo.svg$!', $build['content']['site_logo']['#uri'])) { $build['content']['site_logo']['#uri'] = file_url_transform_relative(file_create_url($logo)); } return $build; }
Please login to continue.