parent
22533eba56
commit
79eb9bef0b
|
@ -5,6 +5,7 @@ dependencies:
|
|||
config:
|
||||
- field.field.node.post.body
|
||||
- field.field.node.post.field_excerpt
|
||||
- field.field.node.post.field_has_tweet
|
||||
- field.field.node.post.field_images
|
||||
- field.field.node.post.field_series
|
||||
- field.field.node.post.field_tags
|
||||
|
@ -42,6 +43,13 @@ content:
|
|||
third_party_settings: { }
|
||||
type: string_textarea
|
||||
region: content
|
||||
field_has_tweet:
|
||||
weight: 26
|
||||
settings:
|
||||
display_label: true
|
||||
third_party_settings: { }
|
||||
type: boolean_checkbox
|
||||
region: content
|
||||
field_images:
|
||||
weight: 9
|
||||
settings:
|
||||
|
|
|
@ -5,6 +5,7 @@ dependencies:
|
|||
config:
|
||||
- field.field.node.post.body
|
||||
- field.field.node.post.field_excerpt
|
||||
- field.field.node.post.field_has_tweet
|
||||
- field.field.node.post.field_images
|
||||
- field.field.node.post.field_series
|
||||
- field.field.node.post.field_tags
|
||||
|
@ -24,6 +25,16 @@ content:
|
|||
settings: { }
|
||||
third_party_settings: { }
|
||||
region: content
|
||||
field_has_tweet:
|
||||
weight: 3
|
||||
label: above
|
||||
settings:
|
||||
format: default
|
||||
format_custom_false: ''
|
||||
format_custom_true: ''
|
||||
third_party_settings: { }
|
||||
type: boolean
|
||||
region: content
|
||||
field_tags:
|
||||
weight: 2
|
||||
label: above
|
||||
|
|
|
@ -6,6 +6,7 @@ dependencies:
|
|||
- core.entity_view_mode.node.teaser
|
||||
- field.field.node.post.body
|
||||
- field.field.node.post.field_excerpt
|
||||
- field.field.node.post.field_has_tweet
|
||||
- field.field.node.post.field_images
|
||||
- field.field.node.post.field_series
|
||||
- field.field.node.post.field_tags
|
||||
|
@ -31,6 +32,7 @@ content:
|
|||
third_party_settings: { }
|
||||
hidden:
|
||||
body: true
|
||||
field_has_tweet: true
|
||||
field_images: true
|
||||
field_series: true
|
||||
field_tags: true
|
||||
|
|
23
config/default/field.field.node.post.field_has_tweet.yml
Normal file
23
config/default/field.field.node.post.field_has_tweet.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
uuid: e9be005a-2f67-4204-ba80-72a74e7f990b
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.node.field_has_tweet
|
||||
- node.type.post
|
||||
id: node.post.field_has_tweet
|
||||
field_name: field_has_tweet
|
||||
entity_type: node
|
||||
bundle: post
|
||||
label: 'Has tweet'
|
||||
description: 'Check to include Twitter''s widget.js script for this page.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value:
|
||||
-
|
||||
value: 0
|
||||
default_value_callback: ''
|
||||
settings:
|
||||
on_label: 'Yes'
|
||||
off_label: 'No'
|
||||
field_type: boolean
|
18
config/default/field.storage.node.field_has_tweet.yml
Normal file
18
config/default/field.storage.node.field_has_tweet.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
uuid: f0ab9755-e7d4-4b86-b4f5-df0472c727dd
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- node
|
||||
id: node.field_has_tweet
|
||||
field_name: field_has_tweet
|
||||
entity_type: node
|
||||
type: boolean
|
||||
settings: { }
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -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…
Reference in a new issue