From e2abf1b9dde5393b82cd5a24893338f46adb5609 Mon Sep 17 00:00:00 2001 From: berliner Date: Thu, 26 Oct 2023 12:42:31 +0200 Subject: [PATCH] HPC-9269: Add mandatory short title field to article content type, add maxlength module and use it for article, document and chapter short title fields --- composer.json | 1 + composer.lock | 77 ++++++++++++++++++- ...tity_form_display.node.article.default.yml | 20 ++++- ...ity_form_display.node.document.default.yml | 6 +- ...lay.paragraph.document_chapter.default.yml | 6 +- ...tity_view_display.node.article.default.yml | 9 +++ ....entity_view_display.node.article.full.yml | 2 + ...ty_view_display.node.article.home_page.yml | 2 + ...rticle.layout_paragraphs_preview_table.yml | 2 + ...tity_view_display.node.article.preview.yml | 2 + ...w_display.node.article.related_article.yml | 2 + ..._view_display.node.article.sub_article.yml | 2 + ...ntity_view_display.node.article.teaser.yml | 2 + ..._view_display.node.article.teaser_card.yml | 2 + config/core.extension.yml | 1 + ...d.field.node.article.field_short_title.yml | 19 +++++ ...h.interactive_content.field_embed_code.yml | 2 +- .../field.storage.node.field_short_title.yml | 2 +- ...ld.storage.paragraph.field_short_title.yml | 2 +- 19 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 config/field.field.node.article.field_short_title.yml diff --git a/composer.json b/composer.json index bbb6676a..7e80b897 100644 --- a/composer.json +++ b/composer.json @@ -72,6 +72,7 @@ "drupal/inline_entity_form": "^1.0@RC", "drupal/layout_paragraphs": "^2", "drupal/maintenance200": "^1.1", + "drupal/maxlength": "^2.1", "drupal/metatag": "^1.16", "drupal/override_node_options": "^2.6", "drupal/paragraphs": "^1.15", diff --git a/composer.lock b/composer.lock index 6a0704f3..282436d6 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": "0473a854b8d86d104234def40ab1af1a", + "content-hash": "b53ef9f1e7366c7dda939df2068350bd", "packages": [ { "name": "asm89/stack-cors", @@ -4690,6 +4690,81 @@ "source": "https://git.drupalcode.org/project/maintenance200" } }, + { + "name": "drupal/maxlength", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/maxlength.git", + "reference": "2.1.2" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/maxlength-2.1.2.zip", + "reference": "2.1.2", + "shasum": "97015e4d1065770a92953c9f37fef5d55b360cf6" + }, + "require": { + "drupal/core": "^9.2 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.1.2", + "datestamp": "1689974531", + "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": "Marius Scurtescu (mariuss)", + "homepage": "https://www.drupal.org/u/mariuss", + "role": "Maintainer" + }, + { + "name": "Clayton Dewey (cedewey)", + "homepage": "https://www.drupal.org/u/cedewey", + "role": "Maintainer" + }, + { + "name": "Daniel Wehner (dawehner)", + "homepage": "https://www.drupal.org/u/dawehner", + "role": "Maintainer" + }, + { + "name": "Paulino Michelazzo (pmichelazzo)", + "homepage": "https://www.drupal.org/u/pmichelazzo", + "role": "Maintainer" + }, + { + "name": "Jeff Hipp (hipp2bsquare)", + "homepage": "https://www.drupal.org/u/hipp2bsquare", + "role": "Maintainer" + }, + { + "name": "Steven DuBois (srdtwc)", + "homepage": "https://www.drupal.org/u/srdtwc", + "role": "Maintainer" + }, + { + "name": "srdtwc", + "homepage": "https://www.drupal.org/user/3422763" + } + ], + "description": "MaxLength allows a soft or hard character limit to be set on titles, text fields and link fields.", + "homepage": "https://www.drupal.org/project/maxlength", + "support": { + "source": "https://git.drupalcode.org/project/maxlength", + "issues": "https://www.drupal.org/project/issues/maxlength" + } + }, { "name": "drupal/metatag", "version": "1.26.0", diff --git a/config/core.entity_form_display.node.article.default.yml b/config/core.entity_form_display.node.article.default.yml index 5dc72dc5..6ba9e583 100755 --- a/config/core.entity_form_display.node.article.default.yml +++ b/config/core.entity_form_display.node.article.default.yml @@ -14,6 +14,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -86,6 +87,7 @@ third_party_settings: group_content: children: - title + - field_short_title - field_summary - field_paragraphs label: Content @@ -178,7 +180,7 @@ content: third_party_settings: { } field_paragraphs: type: layout_paragraphs - weight: 5 + weight: 7 region: content settings: preview_view_mode: preview @@ -199,9 +201,21 @@ content: region: content settings: { } third_party_settings: { } + field_short_title: + type: string_textfield + weight: 5 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: + maxlength: + maxlength_js: 45 + maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' + maxlength_js_enforce: true field_summary: type: text_textarea - weight: 4 + weight: 6 region: content settings: rows: 5 @@ -235,7 +249,7 @@ content: third_party_settings: { } title: type: string_textfield - weight: 3 + weight: 4 region: content settings: size: 60 diff --git a/config/core.entity_form_display.node.document.default.yml b/config/core.entity_form_display.node.document.default.yml index cfbc64da..ad25d55f 100644 --- a/config/core.entity_form_display.node.document.default.yml +++ b/config/core.entity_form_display.node.document.default.yml @@ -158,7 +158,11 @@ content: settings: size: 60 placeholder: '' - third_party_settings: { } + third_party_settings: + maxlength: + maxlength_js: 32 + maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' + maxlength_js_enforce: true field_summary: type: text_textarea weight: 28 diff --git a/config/core.entity_form_display.paragraph.document_chapter.default.yml b/config/core.entity_form_display.paragraph.document_chapter.default.yml index 96180fe4..37b57185 100644 --- a/config/core.entity_form_display.paragraph.document_chapter.default.yml +++ b/config/core.entity_form_display.paragraph.document_chapter.default.yml @@ -107,7 +107,11 @@ content: settings: size: 60 placeholder: '' - third_party_settings: { } + third_party_settings: + maxlength: + maxlength_js: 20 + maxlength_js_label: 'Content limited to @limit characters, remaining: @remaining' + maxlength_js_enforce: true field_summary: type: string_textarea weight: 5 diff --git a/config/core.entity_view_display.node.article.default.yml b/config/core.entity_view_display.node.article.default.yml index da1200a9..8f87a626 100755 --- a/config/core.entity_view_display.node.article.default.yml +++ b/config/core.entity_view_display.node.article.default.yml @@ -14,6 +14,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -83,6 +84,14 @@ content: third_party_settings: { } weight: 3 region: content + field_short_title: + type: string + label: above + settings: + link_to_entity: false + third_party_settings: { } + weight: 4 + region: content links: settings: { } third_party_settings: { } diff --git a/config/core.entity_view_display.node.article.full.yml b/config/core.entity_view_display.node.article.full.yml index 29ff6798..13d3e81b 100644 --- a/config/core.entity_view_display.node.article.full.yml +++ b/config/core.entity_view_display.node.article.full.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -113,6 +114,7 @@ hidden: field_content_space: true field_pdf: true field_report_link: true + field_short_title: true field_summary: true field_tags: true field_thumbnail_image: true diff --git a/config/core.entity_view_display.node.article.home_page.yml b/config/core.entity_view_display.node.article.home_page.yml index 71cf2d6b..7872819e 100755 --- a/config/core.entity_view_display.node.article.home_page.yml +++ b/config/core.entity_view_display.node.article.home_page.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -110,6 +111,7 @@ hidden: field_content_space: true field_pdf: true field_section: true + field_short_title: true field_tags: true field_thumbnail_image: true langcode: true diff --git a/config/core.entity_view_display.node.article.layout_paragraphs_preview_table.yml b/config/core.entity_view_display.node.article.layout_paragraphs_preview_table.yml index 25a724a0..d79fd18a 100644 --- a/config/core.entity_view_display.node.article.layout_paragraphs_preview_table.yml +++ b/config/core.entity_view_display.node.article.layout_paragraphs_preview_table.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -77,6 +78,7 @@ hidden: field_paragraphs: true field_pdf: true field_report_link: true + field_short_title: true field_summary: true field_thumbnail_image: true langcode: true diff --git a/config/core.entity_view_display.node.article.preview.yml b/config/core.entity_view_display.node.article.preview.yml index 2c1d4d36..68fa70f4 100755 --- a/config/core.entity_view_display.node.article.preview.yml +++ b/config/core.entity_view_display.node.article.preview.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -94,6 +95,7 @@ hidden: field_pdf: true field_report_link: true field_section: true + field_short_title: true field_summary: true field_tags: true field_thumbnail_image: true diff --git a/config/core.entity_view_display.node.article.related_article.yml b/config/core.entity_view_display.node.article.related_article.yml index 963147b1..fc5ac5bd 100755 --- a/config/core.entity_view_display.node.article.related_article.yml +++ b/config/core.entity_view_display.node.article.related_article.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -78,6 +79,7 @@ hidden: field_pdf: true field_report_link: true field_section: true + field_short_title: true field_tags: true langcode: true links: true diff --git a/config/core.entity_view_display.node.article.sub_article.yml b/config/core.entity_view_display.node.article.sub_article.yml index 9a4c0180..9acb6757 100755 --- a/config/core.entity_view_display.node.article.sub_article.yml +++ b/config/core.entity_view_display.node.article.sub_article.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -86,6 +87,7 @@ hidden: field_pdf: true field_report_link: true field_section: true + field_short_title: true field_summary: true field_tags: true field_thumbnail_image: true diff --git a/config/core.entity_view_display.node.article.teaser.yml b/config/core.entity_view_display.node.article.teaser.yml index 58e3e845..75de8640 100755 --- a/config/core.entity_view_display.node.article.teaser.yml +++ b/config/core.entity_view_display.node.article.teaser.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -73,6 +74,7 @@ hidden: field_pdf: true field_report_link: true field_section: true + field_short_title: true field_tags: true langcode: true links: true diff --git a/config/core.entity_view_display.node.article.teaser_card.yml b/config/core.entity_view_display.node.article.teaser_card.yml index 76d7bc8e..ba8ec724 100755 --- a/config/core.entity_view_display.node.article.teaser_card.yml +++ b/config/core.entity_view_display.node.article.teaser_card.yml @@ -15,6 +15,7 @@ dependencies: - field.field.node.article.field_pdf - field.field.node.article.field_report_link - field.field.node.article.field_section + - field.field.node.article.field_short_title - field.field.node.article.field_summary - field.field.node.article.field_tags - field.field.node.article.field_thumbnail_image @@ -87,6 +88,7 @@ hidden: field_paragraphs: true field_pdf: true field_report_link: true + field_short_title: true field_tags: true field_thumbnail_image: true langcode: true diff --git a/config/core.extension.yml b/config/core.extension.yml index 1ea706dc..be8690cf 100755 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -57,6 +57,7 @@ module: linked_responsive_image_media_formatter: 0 locale: 0 maintenance200: 0 + maxlength: 0 media: 0 media_library: 0 menu_link_content: 0 diff --git a/config/field.field.node.article.field_short_title.yml b/config/field.field.node.article.field_short_title.yml new file mode 100644 index 00000000..6fea175b --- /dev/null +++ b/config/field.field.node.article.field_short_title.yml @@ -0,0 +1,19 @@ +uuid: d7ed133f-fd02-4aa0-989a-ca42c8f8c705 +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_short_title + - node.type.article +id: node.article.field_short_title +field_name: field_short_title +entity_type: node +bundle: article +label: 'Short title' +description: '' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/config/field.field.paragraph.interactive_content.field_embed_code.yml b/config/field.field.paragraph.interactive_content.field_embed_code.yml index 2cf120f3..c34b44ed 100755 --- a/config/field.field.paragraph.interactive_content.field_embed_code.yml +++ b/config/field.field.paragraph.interactive_content.field_embed_code.yml @@ -10,7 +10,7 @@ field_name: field_embed_code entity_type: paragraph bundle: interactive_content label: 'Embed code' -description: 'Embed code from datawrapper or PowerBi. Do not include a script, only the iframe.' +description: 'Embed code from datawrapper (responsive image). Do not include the script, only the iframe.' required: false translatable: true default_value: { } diff --git a/config/field.storage.node.field_short_title.yml b/config/field.storage.node.field_short_title.yml index 1282191c..863585d4 100644 --- a/config/field.storage.node.field_short_title.yml +++ b/config/field.storage.node.field_short_title.yml @@ -9,7 +9,7 @@ field_name: field_short_title entity_type: node type: string settings: - max_length: 32 + max_length: 255 case_sensitive: false is_ascii: false module: core diff --git a/config/field.storage.paragraph.field_short_title.yml b/config/field.storage.paragraph.field_short_title.yml index c9b0c152..fbe43479 100644 --- a/config/field.storage.paragraph.field_short_title.yml +++ b/config/field.storage.paragraph.field_short_title.yml @@ -9,7 +9,7 @@ field_name: field_short_title entity_type: paragraph type: string settings: - max_length: 16 + max_length: 20 case_sensitive: false is_ascii: false module: core