From cee9fe8616d411aafc3b7dbec8da6fc415347f6c Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Tue, 3 Oct 2023 14:37:12 +0300 Subject: [PATCH 1/7] UHF-8938: Add override caption field to tpr_unit entity --- ...view_display.tpr_unit.tpr_unit.default.yml | 43 +++++++++++-------- ...view_display.tpr_unit.tpr_unit.minimal.yml | 1 + ..._view_display.tpr_unit.tpr_unit.teaser.yml | 1 + .../helfi_tpr_config/helfi_tpr_config.install | 23 ++++++++++ .../helfi_tpr_config/helfi_tpr_config.module | 12 ++++++ translations/new/fi.po | 3 ++ translations/new/sv.po | 3 ++ 7 files changed, 68 insertions(+), 18 deletions(-) diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml index 121cfe902..bd47be39a 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml @@ -27,7 +27,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 14 + weight: 15 region: content accessibility_phone: type: string @@ -35,14 +35,14 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 13 + weight: 14 region: content accessibility_sentences: type: tpr_accessibility_sentence label: hidden settings: { } third_party_settings: { } - weight: 19 + weight: 20 region: content accessibility_www: type: link @@ -54,14 +54,14 @@ content: rel: '' target: '' third_party_settings: { } - weight: 15 + weight: 16 region: content address: type: address_plain label: hidden settings: { } third_party_settings: { } - weight: 5 + weight: 6 region: content address_postal: type: string @@ -69,14 +69,14 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 9 + weight: 10 region: content call_charge_info: type: text_default label: above settings: { } third_party_settings: { } - weight: 11 + weight: 12 region: content description: type: text_default @@ -91,7 +91,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 8 + weight: 9 region: content field_content: type: entity_reference_revisions_entity_view @@ -100,7 +100,7 @@ content: view_mode: default link: '' third_party_settings: { } - weight: 18 + weight: 19 region: content field_lower_content: type: entity_reference_revisions_entity_view @@ -109,21 +109,21 @@ content: view_mode: default link: '' third_party_settings: { } - weight: 20 + weight: 21 region: content field_metatags: type: metatag_empty_formatter label: above settings: { } third_party_settings: { } - weight: 17 + weight: 18 region: content highlights: type: tpr_connection label: hidden settings: { } third_party_settings: { } - weight: 22 + weight: 23 region: content name: type: string @@ -146,7 +146,7 @@ content: label: hidden settings: { } third_party_settings: { } - weight: 7 + weight: 8 region: content phone: type: telephone_link @@ -154,7 +154,7 @@ content: settings: title: '' third_party_settings: { } - weight: 6 + weight: 7 region: content picture_url: type: imagecache_external_responsive_image @@ -174,13 +174,20 @@ content: third_party_settings: { } weight: 4 region: content + picture_url_override_caption: + type: basic_string + label: hidden + settings: { } + third_party_settings: { } + weight: 5 + region: content provided_languages: type: string label: hidden settings: link_to_entity: false third_party_settings: { } - weight: 21 + weight: 22 region: content service_map_embed: type: service_map_embed @@ -190,7 +197,7 @@ content: link_title: 'Open larger map' target: true third_party_settings: { } - weight: 10 + weight: 11 region: content services: type: entity_reference_label @@ -198,7 +205,7 @@ content: settings: link: true third_party_settings: { } - weight: 16 + weight: 17 region: content www: type: link @@ -210,7 +217,7 @@ content: rel: '' target: '' third_party_settings: { } - weight: 12 + weight: 13 region: content hidden: created: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml index bd3087949..7dcabdc63 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml @@ -61,6 +61,7 @@ hidden: phone: true picture_url: true picture_url_override: true + picture_url_override_caption: true provided_languages: true service_map_embed: true services: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml index 1206aabef..531ac6ad3 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml @@ -79,6 +79,7 @@ hidden: longitude: true opening_hours: true phone: true + picture_url_override_caption: true provided_languages: true service_map_embed: true services: true diff --git a/modules/helfi_tpr_config/helfi_tpr_config.install b/modules/helfi_tpr_config/helfi_tpr_config.install index 1d4bfe274..3b1eace4d 100644 --- a/modules/helfi_tpr_config/helfi_tpr_config.install +++ b/modules/helfi_tpr_config/helfi_tpr_config.install @@ -285,3 +285,26 @@ function helfi_tpr_config_update_9044(): void { \Drupal::service('helfi_platform_config.config_update_helper') ->update('helfi_tpr_config'); } + +/** + * UHF-8938: Add a field to tpr_unit and re-import configs. + */ +function helfi_tpr_config_update_9045() : void { + $picture_url_override_caption = BaseFieldDefinition::create('string_long') + ->setTranslatable(TRUE) + ->setRevisionable(FALSE) + ->setLabel(new TranslatableMarkup('Override: Caption')) + ->setDisplayOptions('form', [ + 'type' => 'string_long', + 'weight' => 5, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + \Drupal::entityDefinitionUpdateManager() + ->installFieldStorageDefinition('picture_url_override_caption', 'tpr_unit', 'helfi_tpr_config', $picture_url_override_caption); + + // Re-import 'helfi_tpr_config' configuration. + \Drupal::service('helfi_platform_config.config_update_helper') + ->update('helfi_tpr_config'); +} diff --git a/modules/helfi_tpr_config/helfi_tpr_config.module b/modules/helfi_tpr_config/helfi_tpr_config.module index e5934609f..8beb89cb9 100644 --- a/modules/helfi_tpr_config/helfi_tpr_config.module +++ b/modules/helfi_tpr_config/helfi_tpr_config.module @@ -493,5 +493,17 @@ function helfi_tpr_config_entity_base_field_info(EntityTypeInterface $entity_typ ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); } + if ($entity_type->id() === 'tpr_unit') { + $fields['picture_url_override_caption'] = BaseFieldDefinition::create('string_long') + ->setTranslatable(TRUE) + ->setRevisionable(FALSE) + ->setLabel(new TranslatableMarkup('Override: Caption')) + ->setDisplayOptions('form', [ + 'type' => 'string_long', + 'weight' => 5, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + } return $fields; } diff --git a/translations/new/fi.po b/translations/new/fi.po index 6887e3554..29de9e2de 100644 --- a/translations/new/fi.po +++ b/translations/new/fi.po @@ -505,3 +505,6 @@ msgstr "Tämän on oltava ulkoinen URL-osoite, kuten %url." msgid "Start typing to find content or paste a URL and click on the suggestion below." msgstr "Kirjoita osa sisällön otsikosta tai liitä URL-osoite ja napsauta alla olevaa ehdotusta." + +msgid "Override: Caption" +msgstr "Oletuskuvan korvaavan kuvan kuvateksti" diff --git a/translations/new/sv.po b/translations/new/sv.po index fa7be680a..24569be19 100644 --- a/translations/new/sv.po +++ b/translations/new/sv.po @@ -30,3 +30,6 @@ msgstr "Starta chatten" msgctxt "Floating chat title" msgid "Chat" msgstr "Chatt" + +msgid "Override: Caption" +msgstr "Bildtext för bild som ersätter standardbilden" From 243a57db2e97172049a5da0e152c2b4dd5f94b50 Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Tue, 3 Oct 2023 15:49:27 +0300 Subject: [PATCH 2/7] UHF-8938: Rename the field to unit_picture_caption --- ...tity_view_display.tpr_unit.tpr_unit.default.yml | 14 +++++++------- ...tity_view_display.tpr_unit.tpr_unit.minimal.yml | 2 +- ...ntity_view_display.tpr_unit.tpr_unit.teaser.yml | 2 +- modules/helfi_tpr_config/helfi_tpr_config.install | 7 +++---- modules/helfi_tpr_config/helfi_tpr_config.module | 5 ++--- translations/new/fi.po | 3 --- translations/new/sv.po | 3 --- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml index bd47be39a..8aaf8c75a 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml @@ -174,13 +174,6 @@ content: third_party_settings: { } weight: 4 region: content - picture_url_override_caption: - type: basic_string - label: hidden - settings: { } - third_party_settings: { } - weight: 5 - region: content provided_languages: type: string label: hidden @@ -207,6 +200,13 @@ content: third_party_settings: { } weight: 17 region: content + unit_picture_caption: + type: basic_string + label: hidden + settings: { } + third_party_settings: { } + weight: 5 + region: content www: type: link label: hidden diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml index 7dcabdc63..82679d3ae 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml @@ -61,10 +61,10 @@ hidden: phone: true picture_url: true picture_url_override: true - picture_url_override_caption: true provided_languages: true service_map_embed: true services: true show_www: true streetview_entrance_url: true + unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml index 531ac6ad3..ce52c46ab 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml @@ -79,10 +79,10 @@ hidden: longitude: true opening_hours: true phone: true - picture_url_override_caption: true provided_languages: true service_map_embed: true services: true show_www: true streetview_entrance_url: true + unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/helfi_tpr_config.install b/modules/helfi_tpr_config/helfi_tpr_config.install index 3b1eace4d..71e072df1 100644 --- a/modules/helfi_tpr_config/helfi_tpr_config.install +++ b/modules/helfi_tpr_config/helfi_tpr_config.install @@ -290,19 +290,18 @@ function helfi_tpr_config_update_9044(): void { * UHF-8938: Add a field to tpr_unit and re-import configs. */ function helfi_tpr_config_update_9045() : void { - $picture_url_override_caption = BaseFieldDefinition::create('string_long') + $unit_picture_caption = BaseFieldDefinition::create('string_long') ->setTranslatable(TRUE) ->setRevisionable(FALSE) - ->setLabel(new TranslatableMarkup('Override: Caption')) + ->setLabel(new TranslatableMarkup('Caption')) ->setDisplayOptions('form', [ - 'type' => 'string_long', 'weight' => 5, ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); \Drupal::entityDefinitionUpdateManager() - ->installFieldStorageDefinition('picture_url_override_caption', 'tpr_unit', 'helfi_tpr_config', $picture_url_override_caption); + ->installFieldStorageDefinition('unit_picture_caption', 'tpr_unit', 'helfi_tpr_config', $unit_picture_caption); // Re-import 'helfi_tpr_config' configuration. \Drupal::service('helfi_platform_config.config_update_helper') diff --git a/modules/helfi_tpr_config/helfi_tpr_config.module b/modules/helfi_tpr_config/helfi_tpr_config.module index 8beb89cb9..650a59847 100644 --- a/modules/helfi_tpr_config/helfi_tpr_config.module +++ b/modules/helfi_tpr_config/helfi_tpr_config.module @@ -494,12 +494,11 @@ function helfi_tpr_config_entity_base_field_info(EntityTypeInterface $entity_typ ->setDisplayConfigurable('view', TRUE); } if ($entity_type->id() === 'tpr_unit') { - $fields['picture_url_override_caption'] = BaseFieldDefinition::create('string_long') + $fields['unit_picture_caption'] = BaseFieldDefinition::create('string_long') ->setTranslatable(TRUE) ->setRevisionable(FALSE) - ->setLabel(new TranslatableMarkup('Override: Caption')) + ->setLabel(new TranslatableMarkup('Caption')) ->setDisplayOptions('form', [ - 'type' => 'string_long', 'weight' => 5, ]) ->setDisplayConfigurable('form', TRUE) diff --git a/translations/new/fi.po b/translations/new/fi.po index 29de9e2de..6887e3554 100644 --- a/translations/new/fi.po +++ b/translations/new/fi.po @@ -505,6 +505,3 @@ msgstr "Tämän on oltava ulkoinen URL-osoite, kuten %url." msgid "Start typing to find content or paste a URL and click on the suggestion below." msgstr "Kirjoita osa sisällön otsikosta tai liitä URL-osoite ja napsauta alla olevaa ehdotusta." - -msgid "Override: Caption" -msgstr "Oletuskuvan korvaavan kuvan kuvateksti" diff --git a/translations/new/sv.po b/translations/new/sv.po index 24569be19..fa7be680a 100644 --- a/translations/new/sv.po +++ b/translations/new/sv.po @@ -30,6 +30,3 @@ msgstr "Starta chatten" msgctxt "Floating chat title" msgid "Chat" msgstr "Chatt" - -msgid "Override: Caption" -msgstr "Bildtext för bild som ersätter standardbilden" From f3df908bd0ea9110ab6b3383df609c100c6d6d4c Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Thu, 5 Oct 2023 10:31:02 +0300 Subject: [PATCH 3/7] UHF-8938: Add missing space for settings on core.entity_view_display.tpr_unit.tpr_unit.default.yml --- .../core.entity_view_display.tpr_unit.tpr_unit.default.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml index 8aaf8c75a..b1b07b489 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml @@ -203,8 +203,8 @@ content: unit_picture_caption: type: basic_string label: hidden - settings: { } - third_party_settings: { } + settings: { } + third_party_settings: { } weight: 5 region: content www: From 2d5d4a312d31ca9d654d7941abffe9022f198c43 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 5 Oct 2023 11:28:43 +0300 Subject: [PATCH 4/7] UHF-8938: Removed dependency to helfi_base_content module since it has dependency to editoria11y module that has configuration with broken schema --- .../helfi_eu_cookie_compliance.info.yml | 3 ++- .../tests/src/Functional/EuCookieComplianceTest.php | 1 + modules/helfi_user_roles/helfi_user_roles.install | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/helfi_eu_cookie_compliance/helfi_eu_cookie_compliance.info.yml b/modules/helfi_eu_cookie_compliance/helfi_eu_cookie_compliance.info.yml index e72ce5c39..41bc5ab21 100644 --- a/modules/helfi_eu_cookie_compliance/helfi_eu_cookie_compliance.info.yml +++ b/modules/helfi_eu_cookie_compliance/helfi_eu_cookie_compliance.info.yml @@ -4,7 +4,8 @@ core_version_requirement: '^9 || ^10' dependencies: - drupal:block - eu_cookie_compliance:eu_cookie_compliance - - helfi_base_content:helfi_base_content + - helfi_platform_config:helfi_platform_config + - helfi_user_roles:helfi_user_roles package: HELfi 'interface translation project': helfi_eu_cookie_compliance 'interface translation server pattern': modules/contrib/helfi_platform_config/modules/helfi_eu_cookie_compliance/translations/%language.po diff --git a/modules/helfi_eu_cookie_compliance/tests/src/Functional/EuCookieComplianceTest.php b/modules/helfi_eu_cookie_compliance/tests/src/Functional/EuCookieComplianceTest.php index da59e8cad..6c3d0329e 100644 --- a/modules/helfi_eu_cookie_compliance/tests/src/Functional/EuCookieComplianceTest.php +++ b/modules/helfi_eu_cookie_compliance/tests/src/Functional/EuCookieComplianceTest.php @@ -20,6 +20,7 @@ class EuCookieComplianceTest extends BrowserTestBase { protected static $modules = [ 'block', 'helfi_api_base', + 'helfi_user_roles', 'helfi_eu_cookie_compliance', ]; diff --git a/modules/helfi_user_roles/helfi_user_roles.install b/modules/helfi_user_roles/helfi_user_roles.install index ef7f5e5ad..0ce8ebaa7 100644 --- a/modules/helfi_user_roles/helfi_user_roles.install +++ b/modules/helfi_user_roles/helfi_user_roles.install @@ -15,6 +15,9 @@ use Drupal\user\Entity\User; */ function helfi_user_roles_grant_permissions() : void { $permissions = [ + 'anonymous' => [ + 'access content', + ], 'admin' => [ // @user. 'access user profiles', From 0f7abeecf00552429fbe47126dd74862963ba9af Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 5 Oct 2023 12:35:23 +0300 Subject: [PATCH 5/7] UHF-8938: Removed dependency to helfi_base_content --- modules/helfi_media_chart/helfi_media_chart.info.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/helfi_media_chart/helfi_media_chart.info.yml b/modules/helfi_media_chart/helfi_media_chart.info.yml index 320a2d9bf..9fb38f278 100644 --- a/modules/helfi_media_chart/helfi_media_chart.info.yml +++ b/modules/helfi_media_chart/helfi_media_chart.info.yml @@ -8,7 +8,7 @@ dependencies: - drupal:media - drupal:media_library - drupal:path - - helfi_base_content:helfi_base_content + - drupal:text - helfi_ckeditor:helfi_ckeditor - helfi_media:helfi_media 'interface translation project': helfi_media_chart From 0df8a53870ca5cfcce35a9104cbc7d5f4c9bc436 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 5 Oct 2023 12:51:59 +0300 Subject: [PATCH 6/7] UHF-8938: Removed editora11y dependency --- modules/helfi_base_content/helfi_base_content.info.yml | 1 - modules/helfi_base_content/helfi_base_content.install | 6 ------ 2 files changed, 7 deletions(-) diff --git a/modules/helfi_base_content/helfi_base_content.info.yml b/modules/helfi_base_content/helfi_base_content.info.yml index b39f34482..2ca250bec 100644 --- a/modules/helfi_base_content/helfi_base_content.info.yml +++ b/modules/helfi_base_content/helfi_base_content.info.yml @@ -16,7 +16,6 @@ dependencies: - drupal:taxonomy - drupal:text - easy_breadcrumb:easy_breadcrumb - - editoria11y:editoria11y - entity_reference_revisions:entity_reference_revisions - hdbt_admin_tools:hdbt_admin_tools - helfi_platform_config:helfi_platform_config diff --git a/modules/helfi_base_content/helfi_base_content.install b/modules/helfi_base_content/helfi_base_content.install index 76fb0a170..29cba2604 100644 --- a/modules/helfi_base_content/helfi_base_content.install +++ b/modules/helfi_base_content/helfi_base_content.install @@ -38,8 +38,6 @@ function helfi_base_content_grant_permissions() : void { 'translate configuration', // @content_lock. 'break content lock', - // @editorially. - 'view editoria11y checker', // @locale. 'translate interface', // @menu_link_attributes. @@ -95,8 +93,6 @@ function helfi_base_content_grant_permissions() : void { 'content_producer' => [ // @content_translation. 'translate editable entities', - // @editorially. - 'view editoria11y checker', // @helfi_api_base. 'access remote entities overview', // @menu_link_content. @@ -132,8 +128,6 @@ function helfi_base_content_grant_permissions() : void { 'translate any entity', 'translate editable entities', 'update content translations', - // @editorially. - 'view editoria11y checker', // @node. 'access content overview', 'administer nodes', From cf9f743fbd48457ed8ef3cde5ad93eb36876a76a Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Thu, 5 Oct 2023 15:38:26 +0300 Subject: [PATCH 7/7] UHF-8938: Add for_display configuration for the tpr_unit unit_picture_caption configuration --- ...core.entity_form_display.tpr_unit.tpr_unit.default.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml index d9f377156..9bb2bd2b0 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml @@ -297,6 +297,14 @@ content: region: content settings: { } third_party_settings: { } + unit_picture_caption: + type: string_textarea + weight: 5 + region: content + settings: + rows: 5 + placeholder: '' + third_party_settings: { } www: type: readonly_field_widget weight: 10