parent
79eb9bef0b
commit
165b6e8195
7 changed files with 88 additions and 7 deletions
|
@ -5,20 +5,22 @@
|
|||
* 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\Core\Entity\EntityInterface $node */
|
||||
if (!$node = \Drupal::routeMatch()->getParameter('node')) {
|
||||
/** @var \Drupal\custom\Entity\Node\Post $node */
|
||||
if (!$node = $variables['node']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node->getType() != 'post') {
|
||||
if (!$node instanceof Post) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node->get('field_has_tweet')->getString()) {
|
||||
if ($node->hasTweet()) {
|
||||
$variables['#attached']['library'][] = 'opdavies/twitter';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue