parent
22533eba56
commit
79eb9bef0b
7 changed files with 90 additions and 0 deletions
|
@ -2,6 +2,16 @@ global-styling:
|
|||
css:
|
||||
base:
|
||||
dist/tailwind.css: {}
|
||||
|
||||
global-scripts:
|
||||
js:
|
||||
dist/js/app.js: {}
|
||||
|
||||
twitter:
|
||||
js:
|
||||
https://platform.twitter.com/widgets.js:
|
||||
type: external
|
||||
minified: true
|
||||
attributes:
|
||||
async: true
|
||||
charset: 'utf-8'
|
||||
|
|
|
@ -5,6 +5,24 @@
|
|||
* Functions to support theming in the Tailwind CSS theme.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK().
|
||||
*/
|
||||
function opdavies_preprocess_page(array &$variables): void {
|
||||
/** @var \Drupal\Core\Entity\EntityInterface $node */
|
||||
if (!$node = \Drupal::routeMatch()->getParameter('node')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node->getType() != 'post') {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node->get('field_has_tweet')->getString()) {
|
||||
$variables['#attached']['library'][] = 'opdavies/twitter';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK().
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue