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