Create a block of testimonials

Sorted by weight, added using the Weight module.
https://www.drupal.org/project/weight

If two testimonials have the same weight, they are sorted by their
created date.
This commit is contained in:
Oliver Davies 2025-05-16 00:37:24 +01:00
parent b8ca93ff2b
commit cfb98aea2f
15 changed files with 381 additions and 14 deletions

View file

@ -24,6 +24,7 @@
"drupal/paragraphs": "^1.19",
"drupal/pathauto": "^1.13",
"drupal/tome": "^1.13",
"drupal/weight": "^3.6",
"drush/drush": "^13.5"
},
"conflict": {

69
composer.lock generated
View file

@ -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": "1ff6a5ebbdbd6b8ff35a83d72a82734a",
"content-hash": "9de034f4d257697188aeb2bb2216ee7e",
"packages": [
{
"name": "asm89/stack-cors",
@ -3073,6 +3073,73 @@
"source": "https://git.drupalcode.org/project/tome"
}
},
{
"name": "drupal/weight",
"version": "3.6.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/weight.git",
"reference": "8.x-3.6"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/weight-8.x-3.6.zip",
"reference": "8.x-3.6",
"shasum": "071c378a6f4887b15a9e68c1414c94735282e20c"
},
"require": {
"drupal/core": "^9.5 || ^10.2 || ^11.0"
},
"require-dev": {
"drupal/feeds": "*"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-3.6",
"datestamp": "1729637541",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "heddn",
"homepage": "https://www.drupal.org/user/1463982"
},
{
"name": "kevinquillen",
"homepage": "https://www.drupal.org/user/317279"
},
{
"name": "NancyDru",
"homepage": "https://www.drupal.org/user/101412"
},
{
"name": "neslee canil pinto",
"homepage": "https://www.drupal.org/user/3580850"
},
{
"name": "vladimiraus",
"homepage": "https://www.drupal.org/user/673120"
}
],
"description": "Allows arbitrary ordering of entities.",
"homepage": "https://www.drupal.org/project/weight",
"keywords": [
"Drupal"
],
"support": {
"source": "http://cgit.drupalcode.org/weight",
"issues": "https://www.drupal.org/project/issues/weight"
}
},
{
"name": "drupal/yoast_seo",
"version": "2.1.0",

View file

@ -7,6 +7,7 @@ dependencies:
- field.field.node.testimonial.field_image
- field.field.node.testimonial.field_role
- field.field.node.testimonial.field_url
- field.field.node.testimonial.field_weight
- image.style.thumbnail
- node.type.testimonial
module:
@ -14,6 +15,7 @@ dependencies:
- link
- path
- text
- weight
id: node.testimonial.default
targetEntityType: node
bundle: testimonial
@ -59,6 +61,12 @@ content:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_weight:
type: weight_selector
weight: 123
region: content
settings: { }
third_party_settings: { }
path:
type: path
weight: 30

View file

@ -7,13 +7,15 @@ dependencies:
- field.field.node.testimonial.field_image
- field.field.node.testimonial.field_role
- field.field.node.testimonial.field_url
- image.style.wide
- field.field.node.testimonial.field_weight
- image.style.thumbnail
- node.type.testimonial
module:
- image
- link
- text
- user
- weight
id: node.testimonial.default
targetEntityType: node
bundle: testimonial
@ -31,9 +33,9 @@ content:
label: hidden
settings:
image_link: ''
image_style: wide
image_style: thumbnail
image_loading:
attribute: eager
attribute: lazy
third_party_settings: { }
weight: -1
region: content
@ -57,6 +59,13 @@ content:
third_party_settings: { }
weight: 102
region: content
field_weight:
type: default_weight
label: above
settings: { }
third_party_settings: { }
weight: 103
region: content
links:
settings: { }
third_party_settings: { }

View file

@ -8,6 +8,7 @@ dependencies:
- field.field.node.testimonial.field_image
- field.field.node.testimonial.field_role
- field.field.node.testimonial.field_url
- field.field.node.testimonial.field_weight
- image.style.medium
- node.type.testimonial
module:
@ -46,3 +47,4 @@ content:
hidden:
field_role: true
field_url: true
field_weight: true

View file

@ -73,6 +73,7 @@ module:
update: 0
user: 0
views_ui: 0
weight: 0
yoast_seo: 0
pathauto: 1
views: 10

View file

@ -0,0 +1,24 @@
uuid: 439fa0fe-e67a-4ea2-9459-c6407159086f
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_weight
- node.type.testimonial
module:
- weight
id: node.testimonial.field_weight
field_name: field_weight
entity_type: node
bundle: testimonial
label: Weight
description: ''
required: true
translatable: false
default_value:
-
value: '0'
default_value_callback: ''
settings:
range: '20'
field_type: weight

View file

@ -0,0 +1,20 @@
uuid: c6c510a1-7a57-4fba-b424-ff817e152c1f
langcode: en
status: true
dependencies:
module:
- node
- weight
id: node.field_weight
field_name: field_weight
entity_type: node
type: weight
settings:
unsigned: false
module: weight
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View file

@ -0,0 +1,206 @@
uuid: cb653bfe-32b2-4454-ab25-19244ee2b180
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.full
- node.type.testimonial
module:
- node
- user
id: testimonials
label: Testimonials
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
default:
id: default
display_title: Default
display_plugin: default
position: 0
display_options:
title: Testimonials
fields:
title:
id: title
table: node_field_data
field: title
relationship: none
group_type: group
admin_label: ''
plugin_id: field
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
pager:
type: some
options:
offset: 0
items_per_page: 5
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
empty: { }
sorts:
field_weight_value:
id: field_weight_value
table: node__field_weight
field: field_weight_value
relationship: none
group_type: group
admin_label: ''
plugin_id: standard
order: ASC
expose:
label: ''
field_identifier: ''
exposed: false
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
entity_type: node
entity_field: created
plugin_id: date
order: DESC
expose:
label: ''
field_identifier: ''
exposed: false
granularity: second
arguments: { }
filters:
status:
id: status
table: node_field_data
field: status
entity_type: node
entity_field: status
plugin_id: boolean
value: '1'
group: 1
expose:
operator: ''
type:
id: type
table: node_field_data
field: type
entity_type: node
entity_field: type
plugin_id: bundle
value:
testimonial: testimonial
style:
type: default
row:
type: 'entity:node'
options:
relationship: none
view_mode: full
query:
type: views_query
options:
query_comment: ''
disable_sql_rewrite: false
distinct: false
replica: false
query_tags: { }
relationships: { }
header: { }
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
tags: { }
block_1:
id: block_1
display_title: Block
display_plugin: block
position: 1
display_options:
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
tags: { }

View file

@ -18,7 +18,7 @@
],
"revision_timestamp": [
{
"value": "2025-05-15T23:12:27+00:00"
"value": "2025-05-15T23:35:54+00:00"
}
],
"revision_uid": [
@ -51,7 +51,7 @@
],
"changed": [
{
"value": "2025-05-15T23:12:27+00:00"
"value": "2025-05-15T23:35:54+00:00"
}
],
"promote": [
@ -110,5 +110,10 @@
"title": "",
"options": []
}
],
"field_weight": [
{
"value": -2
}
]
}

View file

@ -18,7 +18,7 @@
],
"revision_timestamp": [
{
"value": "2025-05-15T23:14:44+00:00"
"value": "2025-05-15T23:35:39+00:00"
}
],
"revision_uid": [
@ -51,7 +51,7 @@
],
"changed": [
{
"value": "2025-05-15T23:14:44+00:00"
"value": "2025-05-15T23:35:39+00:00"
}
],
"promote": [
@ -110,5 +110,10 @@
"title": "",
"options": []
}
],
"field_weight": [
{
"value": 0
}
]
}

View file

@ -18,7 +18,7 @@
],
"revision_timestamp": [
{
"value": "2025-05-15T23:11:25+00:00"
"value": "2025-05-15T23:36:00+00:00"
}
],
"revision_uid": [
@ -51,7 +51,7 @@
],
"changed": [
{
"value": "2025-05-15T23:11:25+00:00"
"value": "2025-05-15T23:36:00+00:00"
}
],
"promote": [
@ -110,5 +110,10 @@
"title": "",
"options": []
}
],
"field_weight": [
{
"value": -3
}
]
}

View file

@ -18,7 +18,7 @@
],
"revision_timestamp": [
{
"value": "2025-05-15T23:13:43+00:00"
"value": "2025-05-15T23:35:48+00:00"
}
],
"revision_uid": [
@ -51,7 +51,7 @@
],
"changed": [
{
"value": "2025-05-15T23:13:43+00:00"
"value": "2025-05-15T23:35:48+00:00"
}
],
"promote": [
@ -110,5 +110,10 @@
"title": "",
"options": []
}
],
"field_weight": [
{
"value": -1
}
]
}

View file

@ -18,7 +18,7 @@
],
"revision_timestamp": [
{
"value": "2025-05-15T23:10:08+00:00"
"value": "2025-05-15T23:36:07+00:00"
}
],
"revision_uid": [
@ -51,7 +51,7 @@
],
"changed": [
{
"value": "2025-05-15T23:10:08+00:00"
"value": "2025-05-15T23:36:07+00:00"
}
],
"promote": [
@ -110,5 +110,10 @@
"title": "",
"options": []
}
],
"field_weight": [
{
"value": -5
}
]
}

View file

@ -14,6 +14,10 @@ Podcast:
- Migrate podcast episodes.
- Recreate podcast subscription XML feed.
Testimonials:
- Categorising testimonials.
Presentations:
- Migrate presentations.