diff --git a/composer.json b/composer.json index a9239a9db..6884001a6 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "drupal/paragraphs": "^1.19", "drupal/pathauto": "^1.13", "drupal/tome": "^1.13", + "drupal/twig_tweak": "^3.4", "drupal/weight": "^3.6", "drush/drush": "^13.5" }, diff --git a/composer.lock b/composer.lock index bbd094bd9..c70a1cfa1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9de034f4d257697188aeb2bb2216ee7e", + "content-hash": "cb20390c3a438cf025c27f5250fc3a14", "packages": [ { "name": "asm89/stack-cors", @@ -3073,6 +3073,66 @@ "source": "https://git.drupalcode.org/project/tome" } }, + { + "name": "drupal/twig_tweak", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/twig_tweak.git", + "reference": "3.4.0" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/twig_tweak-3.4.0.zip", + "reference": "3.4.0", + "shasum": "1f47f71b4cfbad97fff11db1adc72c311bb1645e" + }, + "require": { + "drupal/core": "^10.3 || ^11.0", + "ext-json": "*", + "php": ">=8.1", + "twig/twig": "^3.10.3" + }, + "suggest": { + "symfony/var-dumper": "Better dump() function for debugging Twig variables" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "3.4.0", + "datestamp": "1721562308", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^10 || ^11" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "chi", + "homepage": "https://www.drupal.org/user/556138" + } + ], + "description": "A Twig extension with some useful functions and filters for Drupal development.", + "homepage": "https://www.drupal.org/project/twig_tweak", + "keywords": [ + "Drupal", + "Twig" + ], + "support": { + "source": "https://git.drupalcode.org/project/twig_tweak", + "issues": "https://www.drupal.org/project/issues/twig_tweak" + } + }, { "name": "drupal/weight", "version": "3.6.0", diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index bb9146e42..5a17655d6 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -70,6 +70,7 @@ module: tome_static: 0 tome_sync: 0 toolbar: 0 + twig_tweak: 0 update: 0 user: 0 views_ui: 0 diff --git a/themes/opdavies/components/testimonial.html.twig b/themes/opdavies/components/testimonial.html.twig new file mode 100644 index 000000000..7cac4366e --- /dev/null +++ b/themes/opdavies/components/testimonial.html.twig @@ -0,0 +1,33 @@ +
+
+
+ {{ text }} +
+ +
+ +
+
+
diff --git a/themes/opdavies/opdavies.info.yml b/themes/opdavies/opdavies.info.yml index a324fac04..d44c672aa 100644 --- a/themes/opdavies/opdavies.info.yml +++ b/themes/opdavies/opdavies.info.yml @@ -4,3 +4,5 @@ type: theme base theme: false libraries: - opdavies/global-styling +dependencies: + - drupal:twig_tweak diff --git a/themes/opdavies/templates/node--testimonial.html.twig b/themes/opdavies/templates/node--testimonial.html.twig index 3ac8612c7..063023cd1 100644 --- a/themes/opdavies/templates/node--testimonial.html.twig +++ b/themes/opdavies/templates/node--testimonial.html.twig @@ -60,27 +60,16 @@ * @ingroup themeable */ #} - - {{ title_prefix }} - {% if label and not page %} - - {{ label }} - - {% endif %} +{% include '@opdavies/components/testimonial.html.twig' with { + image: { + alt: content.field_image.0['#item'].alt, + uri: node.field_image|file_uri, + }, + name: label, + role: content.field_role.0|render, + text: content.body.0|render, + url: content.field_url.0['#url']|render, +} only %} - {{ title_suffix }} - - {% if display_submitted %} -
- {{ author_picture }} - - {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %} - -
- {% endif %} - - - {{ content }} - - +{{ content|without('body', 'field_image', 'field_role', 'field_url', 'field_weight') }}