Files
DrupalTutorial/themes/honey/honey.theme
2024-07-15 12:33:27 +02:00

23 lines
627 B
PHP

<?php
/**
* @file
* Functions to support theming in the Honey theme.
*/
/**
* Implements hook_preprocess_HOOK() for block.html.twig.
*/
function honey_preprocess_block(&$variables) {
// Add a clearfix class to system branding blocks.
if ($variables['plugin_id'] == 'system_branding_block') {
if (isset($variables['site_logo'])) {
$logo_path = DRUPAL_ROOT . $variables['site_logo'];
// If logo is a SVG lets load it content so we can inline it.
if (strlen($logo_path) - strpos($logo_path, '.svg') === 4) {
$variables['site_logo_svg'] = file_get_contents($logo_path);
}
}
}
}