diff --git a/modules/oe_theme_content_person/config/install/core.entity_view_display.node.oe_person.full.yml b/modules/oe_theme_content_person/config/install/core.entity_view_display.node.oe_person.full.yml index 7c4a14069..dff24e0d5 100644 --- a/modules/oe_theme_content_person/config/install/core.entity_view_display.node.oe_person.full.yml +++ b/modules/oe_theme_content_person/config/install/core.entity_view_display.node.oe_person.full.yml @@ -8,6 +8,7 @@ dependencies: - field.field.node.oe_person.oe_person_biography_timeline - field.field.node.oe_person.oe_person_contacts - field.field.node.oe_person.oe_person_cv + - field.field.node.oe_person.oe_person_description - field.field.node.oe_person.oe_person_displayed_name - field.field.node.oe_person.oe_person_documents - field.field.node.oe_person.oe_person_first_name @@ -44,98 +45,102 @@ third_party_settings: - group_organisation - group_contact - group_responsibilities + - group_description - group_media - group_social_media_links - group_transparency - group_biography - group_presentations + label: 'Page contents' parent_name: '' + region: content weight: 0 format_type: oe_theme_helper_in_page_navigation - region: content format_settings: - id: '' classes: '' - label: 'Page contents' + id: '' group_contact: children: - oe_person_contacts + label: Contact parent_name: group_in_page_navigation + region: content weight: 2 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: Contact + id: '' group_responsibilities: children: - oe_person_jobs + label: Responsibilities parent_name: group_in_page_navigation + region: content weight: 3 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: Responsibilities + id: '' group_transparency: children: - oe_person_transparency_intro - oe_person_transparency_links + label: Transparency parent_name: group_in_page_navigation + region: content weight: 7 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: Transparency + id: '' group_biography: children: - oe_person_biography_intro - oe_person_biography_timeline - oe_person_cv - group_declaration + label: Biography parent_name: group_in_page_navigation + region: content weight: 8 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: Biography + id: '' group_presentations: children: - oe_person_documents + label: 'Articles and presentations' parent_name: group_in_page_navigation + region: content weight: 9 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: 'Articles and presentations' + id: '' group_media: children: - oe_person_media + label: Media parent_name: group_in_page_navigation - weight: 4 - format_type: oe_theme_helper_in_page_navigation_item region: content + weight: 5 + format_type: oe_theme_helper_in_page_navigation_item format_settings: - id: '' classes: '' - label: Media + id: '' group_declaration: children: - oe_person_interests_intro - oe_person_interests_file + label: 'Declaration of interests' parent_name: group_biography + region: content weight: 3 format_type: html_element - region: content format_settings: + classes: '' + id: '' element: div show_label: true label_element: h3 @@ -143,44 +148,53 @@ third_party_settings: attributes: '' effect: none speed: fast - id: '' - classes: '' - label: 'Declaration of interests' group_details: children: - oe_departments - oe_person_organisation + label: '' parent_name: group_organisation + region: content weight: 21 format_type: oe_theme_helper_field_list_pattern - region: content format_settings: - variant: horizontal classes: '' id: '' - label: '' + variant: horizontal group_organisation: children: - group_details + label: '' parent_name: group_in_page_navigation + region: content weight: 1 format_type: oe_theme_helper_in_page_navigation_item - region: content format_settings: - id: '' classes: '' - label: '' + id: '' group_social_media_links: children: - oe_social_media_links + label: '' parent_name: group_in_page_navigation - weight: 5 - format_type: oe_theme_helper_in_page_navigation_item region: content + weight: 6 + format_type: oe_theme_helper_in_page_navigation_item format_settings: - id: '' classes: '' + id: '' + group_description: + children: + - oe_person_description label: '' + parent_name: group_in_page_navigation + region: content + weight: 4 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + show_empty_fields: false + id: '' id: node.oe_person.full targetEntityType: node bundle: oe_person @@ -188,84 +202,89 @@ mode: full content: oe_departments: type: skos_concept_entity_reference_label - weight: 21 - region: content label: hidden settings: link: false third_party_settings: { } + weight: 21 + region: content oe_person_biography_intro: type: text_default - weight: 0 - region: content label: hidden settings: { } third_party_settings: { } + weight: 0 + region: content oe_person_biography_timeline: type: timeline_formatter - weight: 1 - region: content label: hidden settings: limit: '0' show_more: 'Show full timeline' third_party_settings: { } + weight: 1 + region: content oe_person_contacts: type: entity_reference_revisions_entity_view - weight: 6 - region: content label: hidden settings: view_mode: full link: '' third_party_settings: { } + weight: 6 + region: content oe_person_cv: type: entity_reference_entity_view - weight: 2 - region: content label: hidden settings: - link: true view_mode: default + link: true + third_party_settings: { } + weight: 2 + region: content + oe_person_description: + type: text_default + label: hidden + settings: { } third_party_settings: { } - oe_person_documents: - type: entity_reference_revisions_entity_view weight: 0 region: content + oe_person_documents: + type: entity_reference_revisions_entity_view label: hidden settings: view_mode: full link: '' third_party_settings: { } + weight: 0 + region: content oe_person_interests_file: type: entity_reference_entity_view - weight: 6 - region: content label: hidden settings: - link: true view_mode: default + link: true third_party_settings: { } + weight: 6 + region: content oe_person_interests_intro: type: text_default - weight: 4 - region: content label: hidden settings: { } third_party_settings: { } + weight: 4 + region: content oe_person_jobs: type: entity_reference_revisions_entity_view - weight: 16 - region: content label: hidden settings: view_mode: full link: '' third_party_settings: { } + weight: 16 + region: content oe_person_media: type: oe_theme_helper_media_gallery - weight: 0 - region: content label: above settings: image_style: large @@ -280,25 +299,25 @@ content: caption: name copyright: '' third_party_settings: { } + weight: 0 + region: content oe_person_organisation: type: entity_reference_label - weight: 22 - region: content label: hidden settings: link: false third_party_settings: { } + weight: 22 + region: content oe_person_transparency_intro: type: text_default - weight: 0 - region: content label: hidden settings: { } third_party_settings: { } + weight: 0 + region: content oe_person_transparency_links: type: link - weight: 1 - region: content label: hidden settings: trim_length: 80 @@ -307,20 +326,22 @@ content: rel: '' target: '' third_party_settings: { } + weight: 1 + region: content oe_social_media_links: type: oe_theme_helper_social_media_links_formatter - weight: 6 - region: content label: hidden settings: trim_length: 80 - title: 'Follow the latest progress and learn more about getting involved.' - variant: horizontal url_only: false url_plain: false rel: '' target: '' + title: 'Follow the latest progress and learn more about getting involved.' + variant: horizontal third_party_settings: { } + weight: 6 + region: content hidden: extra_field_oe_theme_content_person_job_list: true extra_field_oe_theme_helper_short_title_with_fallback: true diff --git a/modules/oe_theme_content_person/config/post_updates/30001_add_description_field/core.entity_view_display.node.oe_person.full.yml b/modules/oe_theme_content_person/config/post_updates/30001_add_description_field/core.entity_view_display.node.oe_person.full.yml new file mode 100644 index 000000000..dff24e0d5 --- /dev/null +++ b/modules/oe_theme_content_person/config/post_updates/30001_add_description_field/core.entity_view_display.node.oe_person.full.yml @@ -0,0 +1,362 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.full + - field.field.node.oe_person.oe_departments + - field.field.node.oe_person.oe_person_biography_intro + - field.field.node.oe_person.oe_person_biography_timeline + - field.field.node.oe_person.oe_person_contacts + - field.field.node.oe_person.oe_person_cv + - field.field.node.oe_person.oe_person_description + - field.field.node.oe_person.oe_person_displayed_name + - field.field.node.oe_person.oe_person_documents + - field.field.node.oe_person.oe_person_first_name + - field.field.node.oe_person.oe_person_gender + - field.field.node.oe_person.oe_person_interests_file + - field.field.node.oe_person.oe_person_interests_intro + - field.field.node.oe_person.oe_person_jobs + - field.field.node.oe_person.oe_person_last_name + - field.field.node.oe_person.oe_person_media + - field.field.node.oe_person.oe_person_organisation + - field.field.node.oe_person.oe_person_photo + - field.field.node.oe_person.oe_person_transparency_intro + - field.field.node.oe_person.oe_person_transparency_links + - field.field.node.oe_person.oe_person_type + - field.field.node.oe_person.oe_social_media_links + - field.field.node.oe_person.oe_subject + - field.field.node.oe_person.oe_summary + - field.field.node.oe_person.oe_teaser + - image.style.large + - node.type.oe_person + module: + - entity_reference_revisions + - field_group + - link + - oe_content_timeline_field + - oe_theme_helper + - rdf_skos + - text + - user +third_party_settings: + field_group: + group_in_page_navigation: + children: + - group_organisation + - group_contact + - group_responsibilities + - group_description + - group_media + - group_social_media_links + - group_transparency + - group_biography + - group_presentations + label: 'Page contents' + parent_name: '' + region: content + weight: 0 + format_type: oe_theme_helper_in_page_navigation + format_settings: + classes: '' + id: '' + group_contact: + children: + - oe_person_contacts + label: Contact + parent_name: group_in_page_navigation + region: content + weight: 2 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_responsibilities: + children: + - oe_person_jobs + label: Responsibilities + parent_name: group_in_page_navigation + region: content + weight: 3 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_transparency: + children: + - oe_person_transparency_intro + - oe_person_transparency_links + label: Transparency + parent_name: group_in_page_navigation + region: content + weight: 7 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_biography: + children: + - oe_person_biography_intro + - oe_person_biography_timeline + - oe_person_cv + - group_declaration + label: Biography + parent_name: group_in_page_navigation + region: content + weight: 8 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_presentations: + children: + - oe_person_documents + label: 'Articles and presentations' + parent_name: group_in_page_navigation + region: content + weight: 9 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_media: + children: + - oe_person_media + label: Media + parent_name: group_in_page_navigation + region: content + weight: 5 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_declaration: + children: + - oe_person_interests_intro + - oe_person_interests_file + label: 'Declaration of interests' + parent_name: group_biography + region: content + weight: 3 + format_type: html_element + format_settings: + classes: '' + id: '' + element: div + show_label: true + label_element: h3 + label_element_classes: ecl-u-type-heading-3 + attributes: '' + effect: none + speed: fast + group_details: + children: + - oe_departments + - oe_person_organisation + label: '' + parent_name: group_organisation + region: content + weight: 21 + format_type: oe_theme_helper_field_list_pattern + format_settings: + classes: '' + id: '' + variant: horizontal + group_organisation: + children: + - group_details + label: '' + parent_name: group_in_page_navigation + region: content + weight: 1 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_social_media_links: + children: + - oe_social_media_links + label: '' + parent_name: group_in_page_navigation + region: content + weight: 6 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + id: '' + group_description: + children: + - oe_person_description + label: '' + parent_name: group_in_page_navigation + region: content + weight: 4 + format_type: oe_theme_helper_in_page_navigation_item + format_settings: + classes: '' + show_empty_fields: false + id: '' +id: node.oe_person.full +targetEntityType: node +bundle: oe_person +mode: full +content: + oe_departments: + type: skos_concept_entity_reference_label + label: hidden + settings: + link: false + third_party_settings: { } + weight: 21 + region: content + oe_person_biography_intro: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content + oe_person_biography_timeline: + type: timeline_formatter + label: hidden + settings: + limit: '0' + show_more: 'Show full timeline' + third_party_settings: { } + weight: 1 + region: content + oe_person_contacts: + type: entity_reference_revisions_entity_view + label: hidden + settings: + view_mode: full + link: '' + third_party_settings: { } + weight: 6 + region: content + oe_person_cv: + type: entity_reference_entity_view + label: hidden + settings: + view_mode: default + link: true + third_party_settings: { } + weight: 2 + region: content + oe_person_description: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content + oe_person_documents: + type: entity_reference_revisions_entity_view + label: hidden + settings: + view_mode: full + link: '' + third_party_settings: { } + weight: 0 + region: content + oe_person_interests_file: + type: entity_reference_entity_view + label: hidden + settings: + view_mode: default + link: true + third_party_settings: { } + weight: 6 + region: content + oe_person_interests_intro: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 4 + region: content + oe_person_jobs: + type: entity_reference_revisions_entity_view + label: hidden + settings: + view_mode: full + link: '' + third_party_settings: { } + weight: 16 + region: content + oe_person_media: + type: oe_theme_helper_media_gallery + label: above + settings: + image_style: large + bundle_settings: + av_portal_photo: + caption: name + copyright: '' + av_portal_video: + caption: name + copyright: '' + image: + caption: name + copyright: '' + third_party_settings: { } + weight: 0 + region: content + oe_person_organisation: + type: entity_reference_label + label: hidden + settings: + link: false + third_party_settings: { } + weight: 22 + region: content + oe_person_transparency_intro: + type: text_default + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content + oe_person_transparency_links: + type: link + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + weight: 1 + region: content + oe_social_media_links: + type: oe_theme_helper_social_media_links_formatter + label: hidden + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + title: 'Follow the latest progress and learn more about getting involved.' + variant: horizontal + third_party_settings: { } + weight: 6 + region: content +hidden: + extra_field_oe_theme_content_person_job_list: true + extra_field_oe_theme_helper_short_title_with_fallback: true + langcode: true + links: true + oe_content_content_owner: true + oe_content_legacy_link: true + oe_content_navigation_title: true + oe_content_short_title: true + oe_person_displayed_name: true + oe_person_first_name: true + oe_person_gender: true + oe_person_last_name: true + oe_person_photo: true + oe_person_type: true + oe_subject: true + oe_summary: true + oe_teaser: true diff --git a/modules/oe_theme_content_person/oe_theme_content_person.post_update.php b/modules/oe_theme_content_person/oe_theme_content_person.post_update.php index 251dd7eec..dc5b6a5f0 100644 --- a/modules/oe_theme_content_person/oe_theme_content_person.post_update.php +++ b/modules/oe_theme_content_person/oe_theme_content_person.post_update.php @@ -57,3 +57,28 @@ function oe_theme_content_person_post_update_20002() { $entity = $entity_storage->createFromStorageRecord($config); $entity->save(); } + +/** + * Add Description field for Person content type. + */ +function oe_theme_content_person_post_update_30001() { + $storage = new FileStorage(\Drupal::service('extension.list.module')->getPath('oe_theme_content_person') . '/config/post_updates/30001_add_description_field'); + + $entity_type_manager = \Drupal::entityTypeManager(); + $display_values = $storage->read('core.entity_view_display.node.oe_person.full'); + + /** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $entity_storage */ + $entity_storage = $entity_type_manager->getStorage('entity_view_display'); + $existing_display = EntityViewDisplay::load($display_values['id']); + if ($existing_display) { + + // We are creating the config which means that we are also shipping + // it in the config/install folder so we want to make sure it gets the hash + // so Drupal treats it as a shipped config. This means that it gets exposed + // to be translated via the locale system as well. + $config['_core']['default_config_hash'] = Crypt::hashBase64(serialize($display_values)); + + $updated_display = $entity_storage->updateFromStorageRecord($existing_display, $display_values); + $updated_display->save(); + } +} diff --git a/tests/src/Functional/ContentPersonRenderTest.php b/tests/src/Functional/ContentPersonRenderTest.php index 6620959ba..5ab902ddb 100644 --- a/tests/src/Functional/ContentPersonRenderTest.php +++ b/tests/src/Functional/ContentPersonRenderTest.php @@ -505,6 +505,13 @@ public function testPersonRendering(): void { // The gallery is not rendered on non_eu persons. $this->assertSession()->elementNotExists('css', 'section.ecl-gallery'); + + // Assert Description field. + $node->set('oe_person_description', 'Person description text')->save(); + $this->drupalGet($node->toUrl()); + $content_items = $content->findAll('xpath', '/div'); + $this->assertCount(5, $content_items); + $this->assertEquals('Person description text', $content_items[3]->find('css', '.ecl p')->getText()); } /**