Create a testimonial component
This commit is contained in:
parent
a2a4d00aba
commit
e121a05f0f
6 changed files with 109 additions and 23 deletions
|
@ -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"
|
||||
},
|
||||
|
|
62
composer.lock
generated
62
composer.lock
generated
|
@ -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",
|
||||
|
|
|
@ -70,6 +70,7 @@ module:
|
|||
tome_static: 0
|
||||
tome_sync: 0
|
||||
toolbar: 0
|
||||
twig_tweak: 0
|
||||
update: 0
|
||||
user: 0
|
||||
views_ui: 0
|
||||
|
|
33
themes/opdavies/components/testimonial.html.twig
Normal file
33
themes/opdavies/components/testimonial.html.twig
Normal file
|
@ -0,0 +1,33 @@
|
|||
<article>
|
||||
<div class="prose prose-p:text-black prose-a:font-light prose-a:text-blue-primary prose-p:text-lg prose-blockquote:border-blue-primary dark:marker:text-white prose-li:my-1 prose-li:text-lg prose-figcaption:text-white prose-li:text-black marker:text-black dark:prose-p:text-white dark:prose-invert dark:prose-a:text-blue-400 dark:prose-blockquote:border-blue-400 dark:prose-li:text-white hover:prose-a:no-underline prose-h2:text-xl prose-code:font-normal prose-h2:mb-4 prose-ul:my-3 dark:prose-hr:border-grey-400 prose-code:before:content-[''] prose-code:after:content-['']">
|
||||
<blockquote>
|
||||
{{ text }}
|
||||
</blockquote>
|
||||
|
||||
<div>
|
||||
<footer class="mt-8 flex items-center space-x-4 space-x-reverse">
|
||||
<span class="text-base">
|
||||
{% if url %}
|
||||
<a href="{{ url }}">{{ name }}</a>
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
||||
|
||||
{% if role %}
|
||||
- {{ role }}
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
{% if image %}
|
||||
<span class="not-prose order-first flex-shrink-0">
|
||||
{{ drupal_image(image.uri, 'thumbnail', {
|
||||
alt: image.alt,
|
||||
class: 'size-16 rounded-full ring-[3px] ring-blue-primary dark:ring-white',
|
||||
loading: 'lazy',
|
||||
}) }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
|
@ -4,3 +4,5 @@ type: theme
|
|||
base theme: false
|
||||
libraries:
|
||||
- opdavies/global-styling
|
||||
dependencies:
|
||||
- drupal:twig_tweak
|
||||
|
|
|
@ -60,27 +60,16 @@
|
|||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<article{{ attributes }}>
|
||||
{{ title_prefix }}
|
||||
|
||||
{% if label and not page %}
|
||||
<h2{{ title_attributes }}>
|
||||
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
|
||||
</h2>
|
||||
{% 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 %}
|
||||
<footer>
|
||||
{{ author_picture }}
|
||||
<div{{ author_attributes }}>
|
||||
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
|
||||
</div>
|
||||
</footer>
|
||||
{% endif %}
|
||||
|
||||
<div{{ content_attributes }}>
|
||||
{{ content }}
|
||||
</div>
|
||||
</article>
|
||||
{{ content|without('body', 'field_image', 'field_role', 'field_url', 'field_weight') }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue