oliverdavies.uk/web/themes/custom/opdavies/opdavies.theme
2020-09-04 22:20:30 +01:00

27 lines
481 B
Text

<?php
/**
* @file
* Functions to support theming in the Tailwind CSS theme.
*/
use Drupal\opdavies_blog\Entity\Node\Post;
/**
* Implements hook_preprocess_HOOK().
*/
function opdavies_preprocess_page(array &$variables): void {
/** @var Post|null $node */
$node = $variables['node'] ?? NULL;
if (!$node) {
return;
}
if (!$node instanceof Post) {
return;
}
if ($node->hasTweet()) {
$variables['#attached']['library'][] = 'opdavies/twitter';
}
}