function color_block_view_pre_render
color_block_view_pre_render(array $build)
#pre_render callback: Sets color preset logo.
File
- core/modules/color/color.module, line 119
- 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; }
© 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!color!color.module/function/color_block_view_pre_render/8.1.x