From cfb98aea2fedf8e3e43d99fc5d9160f938a53960 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 16 May 2025 00:37:24 +0100 Subject: [PATCH] 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. --- composer.json | 1 + composer.lock | 69 +++++- ..._form_display.node.testimonial.default.yml | 8 + ..._view_display.node.testimonial.default.yml | 15 +- ...y_view_display.node.testimonial.teaser.yml | 2 + config/sync/core.extension.yml | 1 + ...ld.field.node.testimonial.field_weight.yml | 24 ++ .../sync/field.storage.node.field_weight.yml | 20 ++ config/sync/views.view.testimonials.yml | 206 ++++++++++++++++++ ....3b5e623f-380d-400b-9ab3-a5820435308d.json | 9 +- ....530c4270-2e61-4e03-af91-4969a5ac9b01.json | 9 +- ....6014dd95-0f42-46db-bf3d-374af33c4d50.json | 9 +- ....839c2e94-c8a7-48f8-9af3-9be39ac3734c.json | 9 +- ....e0857657-a20c-4449-81b3-0e38bc7ddfa0.json | 9 +- todo.txt | 4 + 15 files changed, 381 insertions(+), 14 deletions(-) create mode 100644 config/sync/field.field.node.testimonial.field_weight.yml create mode 100644 config/sync/field.storage.node.field_weight.yml create mode 100644 config/sync/views.view.testimonials.yml diff --git a/composer.json b/composer.json index 1bff96327..a9239a9db 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/composer.lock b/composer.lock index a041a088f..bbd094bd9 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": "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", diff --git a/config/sync/core.entity_form_display.node.testimonial.default.yml b/config/sync/core.entity_form_display.node.testimonial.default.yml index eba66f574..f9a4eb64e 100644 --- a/config/sync/core.entity_form_display.node.testimonial.default.yml +++ b/config/sync/core.entity_form_display.node.testimonial.default.yml @@ -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 diff --git a/config/sync/core.entity_view_display.node.testimonial.default.yml b/config/sync/core.entity_view_display.node.testimonial.default.yml index 243a8d5e3..c4095b29a 100644 --- a/config/sync/core.entity_view_display.node.testimonial.default.yml +++ b/config/sync/core.entity_view_display.node.testimonial.default.yml @@ -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: { } diff --git a/config/sync/core.entity_view_display.node.testimonial.teaser.yml b/config/sync/core.entity_view_display.node.testimonial.teaser.yml index 12698618b..d35233271 100644 --- a/config/sync/core.entity_view_display.node.testimonial.teaser.yml +++ b/config/sync/core.entity_view_display.node.testimonial.teaser.yml @@ -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 diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index c779e8893..bb9146e42 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -73,6 +73,7 @@ module: update: 0 user: 0 views_ui: 0 + weight: 0 yoast_seo: 0 pathauto: 1 views: 10 diff --git a/config/sync/field.field.node.testimonial.field_weight.yml b/config/sync/field.field.node.testimonial.field_weight.yml new file mode 100644 index 000000000..18b876e47 --- /dev/null +++ b/config/sync/field.field.node.testimonial.field_weight.yml @@ -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 diff --git a/config/sync/field.storage.node.field_weight.yml b/config/sync/field.storage.node.field_weight.yml new file mode 100644 index 000000000..224ee96aa --- /dev/null +++ b/config/sync/field.storage.node.field_weight.yml @@ -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 diff --git a/config/sync/views.view.testimonials.yml b/config/sync/views.view.testimonials.yml new file mode 100644 index 000000000..c943d3ab0 --- /dev/null +++ b/config/sync/views.view.testimonials.yml @@ -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: { } diff --git a/content/node.3b5e623f-380d-400b-9ab3-a5820435308d.json b/content/node.3b5e623f-380d-400b-9ab3-a5820435308d.json index a500c7244..b3bac76b5 100644 --- a/content/node.3b5e623f-380d-400b-9ab3-a5820435308d.json +++ b/content/node.3b5e623f-380d-400b-9ab3-a5820435308d.json @@ -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 + } ] } \ No newline at end of file diff --git a/content/node.530c4270-2e61-4e03-af91-4969a5ac9b01.json b/content/node.530c4270-2e61-4e03-af91-4969a5ac9b01.json index db1d5e554..afe5686ab 100644 --- a/content/node.530c4270-2e61-4e03-af91-4969a5ac9b01.json +++ b/content/node.530c4270-2e61-4e03-af91-4969a5ac9b01.json @@ -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 + } ] } \ No newline at end of file diff --git a/content/node.6014dd95-0f42-46db-bf3d-374af33c4d50.json b/content/node.6014dd95-0f42-46db-bf3d-374af33c4d50.json index bb3dbf747..3b85ef238 100644 --- a/content/node.6014dd95-0f42-46db-bf3d-374af33c4d50.json +++ b/content/node.6014dd95-0f42-46db-bf3d-374af33c4d50.json @@ -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 + } ] } \ No newline at end of file diff --git a/content/node.839c2e94-c8a7-48f8-9af3-9be39ac3734c.json b/content/node.839c2e94-c8a7-48f8-9af3-9be39ac3734c.json index 2aa7658f2..1d3960547 100644 --- a/content/node.839c2e94-c8a7-48f8-9af3-9be39ac3734c.json +++ b/content/node.839c2e94-c8a7-48f8-9af3-9be39ac3734c.json @@ -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 + } ] } \ No newline at end of file diff --git a/content/node.e0857657-a20c-4449-81b3-0e38bc7ddfa0.json b/content/node.e0857657-a20c-4449-81b3-0e38bc7ddfa0.json index 335eda9aa..5583ee40f 100644 --- a/content/node.e0857657-a20c-4449-81b3-0e38bc7ddfa0.json +++ b/content/node.e0857657-a20c-4449-81b3-0e38bc7ddfa0.json @@ -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 + } ] } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 2bb390157..ab4dc13d2 100644 --- a/todo.txt +++ b/todo.txt @@ -14,6 +14,10 @@ Podcast: - Migrate podcast episodes. - Recreate podcast subscription XML feed. +Testimonials: + +- Categorising testimonials. + Presentations: - Migrate presentations.