From dd1b65f44265431d83e4931316c8556cfe27843c Mon Sep 17 00:00:00 2001 From: Mike Herchel <27056-mherchel@users.noreply.drupalcode.org> Date: Fri, 10 Jan 2025 02:00:37 +0000 Subject: [PATCH] Issue #3491813 by pameeela, mherchel, phenaproxima, kristen pol, tonypaulbarker: Implement designs for case study/project full page display within Olivero --- drupal_cms_olivero/css/base/buttons.css | 13 ++- drupal_cms_olivero/css/components/card.css | 4 +- .../css/components/case-study-full.css | 14 ++++ .../css/components/project-full.css | 14 ++++ .../drupal_cms_olivero.libraries.yml | 8 ++ drupal_cms_olivero/drupal_cms_olivero.theme | 14 ++++ ...client-link--case-study--default.html.twig | 37 +++++++++ ...client-name--case-study--default.html.twig | 37 +++++++++ ...t--client-link--project--default.html.twig | 37 +++++++++ ...t--client-name--project--default.html.twig | 37 +++++++++ .../Functional/ComponentValidationTest.php | 6 ++ ...y_form_display.node.case_study.default.yml | 63 +++++++-------- ...y_view_display.node.case_study.default.yml | 58 ++++++------- ...se_study.field_case_study__client_link.yml | 2 +- .../Functional/ComponentValidationTest.php | 6 ++ .../Functional/ComponentValidationTest.php | 6 ++ .../Functional/ComponentValidationTest.php | 6 ++ ....entity_form_display.node.page.default.yml | 5 -- .../Functional/ComponentValidationTest.php | 6 ++ .../Functional/ComponentValidationTest.php | 6 ++ ...tity_form_display.node.project.default.yml | 81 +++++++++---------- ...tity_view_display.node.project.default.yml | 17 ++-- ...ode.project.field_project__client_link.yml | 2 +- .../Functional/ComponentValidationTest.php | 6 ++ 24 files changed, 361 insertions(+), 124 deletions(-) create mode 100644 drupal_cms_olivero/css/components/case-study-full.css create mode 100644 drupal_cms_olivero/css/components/project-full.css create mode 100644 drupal_cms_olivero/templates/field/field--node--field-case-study--client-link--case-study--default.html.twig create mode 100644 drupal_cms_olivero/templates/field/field--node--field-case-study--client-name--case-study--default.html.twig create mode 100644 drupal_cms_olivero/templates/field/field--node--field-project--client-link--project--default.html.twig create mode 100644 drupal_cms_olivero/templates/field/field--node--field-project--client-name--project--default.html.twig diff --git a/drupal_cms_olivero/css/base/buttons.css b/drupal_cms_olivero/css/base/buttons.css index 77e60e07b..1b4c2c1a0 100644 --- a/drupal_cms_olivero/css/base/buttons.css +++ b/drupal_cms_olivero/css/base/buttons.css @@ -6,10 +6,12 @@ .button--external { gap: 8px; - &:after { + /* Only show external icon if href starts with "http" */ + &:where([href^="http" i]):after { content: ""; width: 15px; height: 15px; + margin-top: -0.2lh; -webkit-mask-image: url('../../images/external.svg'); mask-image: url('../../images/external.svg'); -webkit-mask-repeat: no-repeat; @@ -25,3 +27,12 @@ } } } + +.button--link[class] { + border: 0; + padding: 0; + + &:hover { + border: 0; + } +} diff --git a/drupal_cms_olivero/css/components/card.css b/drupal_cms_olivero/css/components/card.css index fbe0dcb76..71c3b9963 100644 --- a/drupal_cms_olivero/css/components/card.css +++ b/drupal_cms_olivero/css/components/card.css @@ -63,7 +63,9 @@ padding-inline: 1.5rem 4rem; } - .field--name-field-event__date { + .field--name-field-event__date, + .field--name-field-case-study__client-name, + .field--name-field-project__client-name{ color: var(--color-text-neutral-soft); font-size: 0.875rem; line-height: var(--sp); diff --git a/drupal_cms_olivero/css/components/case-study-full.css b/drupal_cms_olivero/css/components/case-study-full.css new file mode 100644 index 000000000..6c2e89e79 --- /dev/null +++ b/drupal_cms_olivero/css/components/case-study-full.css @@ -0,0 +1,14 @@ +/** + * @file + * Styles for case study content type. + */ + +.field--name-field-case-study__client-logo { + margin-bottom: var(--sp2); +} + +.node--type-case-study { + .field--name-field-content { + margin-bottom: var(--sp3); + } +} diff --git a/drupal_cms_olivero/css/components/project-full.css b/drupal_cms_olivero/css/components/project-full.css new file mode 100644 index 000000000..6009655ea --- /dev/null +++ b/drupal_cms_olivero/css/components/project-full.css @@ -0,0 +1,14 @@ +/** + * @file + * Styles for case study content type. + */ + +.field--name-field-project__client-logo { + margin-bottom: var(--sp2); +} + +.node--type-project { + .field--name-field-content { + margin-bottom: var(--sp3); + } +} diff --git a/drupal_cms_olivero/drupal_cms_olivero.libraries.yml b/drupal_cms_olivero/drupal_cms_olivero.libraries.yml index c85573eae..c9f18f532 100644 --- a/drupal_cms_olivero/drupal_cms_olivero.libraries.yml +++ b/drupal_cms_olivero/drupal_cms_olivero.libraries.yml @@ -23,3 +23,11 @@ event-full: css: component: css/components/event-full.css: {} +case-study-full: + css: + component: + css/components/case-study-full.css: {} +project-full: + css: + component: + css/components/project-full.css: {} diff --git a/drupal_cms_olivero/drupal_cms_olivero.theme b/drupal_cms_olivero/drupal_cms_olivero.theme index f4e5d066d..43059a137 100644 --- a/drupal_cms_olivero/drupal_cms_olivero.theme +++ b/drupal_cms_olivero/drupal_cms_olivero.theme @@ -40,6 +40,20 @@ function drupal_cms_olivero_preprocess_node__event__full(array &$variables): voi $variables['#attached']['library'][] = 'drupal_cms_olivero/event-full'; } +/** + * Implements hook_preprocess_node__case_study__full(). + */ +function drupal_cms_olivero_preprocess_node__case_study__full(array &$variables): void { + $variables['#attached']['library'][] = 'drupal_cms_olivero/case-study-full'; +} + +/** + * Implements hook_preprocess_node__project__full(). + */ +function drupal_cms_olivero_preprocess_node__project__full(array &$variables): void { + $variables['#attached']['library'][] = 'drupal_cms_olivero/project-full'; +} + /** * Implements hook_preprocess_block(). */ diff --git a/drupal_cms_olivero/templates/field/field--node--field-case-study--client-link--case-study--default.html.twig b/drupal_cms_olivero/templates/field/field--node--field-case-study--client-link--case-study--default.html.twig new file mode 100644 index 000000000..9bf9f8766 --- /dev/null +++ b/drupal_cms_olivero/templates/field/field--node--field-case-study--client-link--case-study--default.html.twig @@ -0,0 +1,37 @@ +{# +/** + * @file + * Theme override for the case study content type's client link field. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - label_hidden: Whether to show the field label or not. + * - title_attributes: HTML attributes for the title. + * - label: The label for the field. + * - multiple: TRUE if a field can contain multiple items. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item's content. + * - entity_type: The entity type to which the field belongs. + * - field_name: The name of the field. + * - field_type: The type of the field. + * - label_display: The display settings for the label. + * + * + * @see template_preprocess_field() + */ +#} + +{% + set classes = [ + 'field', + 'field--name-' ~ field_name|clean_class, + 'field--type-' ~ field_type|clean_class, + 'field--label-' ~ label_display, + label_display == 'inline' ? 'clearfix', + ] +%} + +{% for item in items %} + <div{{ item.attributes.addClass(classes) }}>{{ item.content|add_class('button button--link button--external') }}</div> +{% endfor %} diff --git a/drupal_cms_olivero/templates/field/field--node--field-case-study--client-name--case-study--default.html.twig b/drupal_cms_olivero/templates/field/field--node--field-case-study--client-name--case-study--default.html.twig new file mode 100644 index 000000000..1873c16d3 --- /dev/null +++ b/drupal_cms_olivero/templates/field/field--node--field-case-study--client-name--case-study--default.html.twig @@ -0,0 +1,37 @@ +{# +/** + * @file + * Theme override for the case study content type's name field. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - label_hidden: Whether to show the field label or not. + * - title_attributes: HTML attributes for the title. + * - label: The label for the field. + * - multiple: TRUE if a field can contain multiple items. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item's content. + * - entity_type: The entity type to which the field belongs. + * - field_name: The name of the field. + * - field_type: The type of the field. + * - label_display: The display settings for the label. + * + * + * @see template_preprocess_field() + */ +#} + +{% + set classes = [ + 'field', + 'field--name-' ~ field_name|clean_class, + 'field--type-' ~ field_type|clean_class, + 'field--label-' ~ label_display, + label_display == 'inline' ? 'clearfix', + ] +%} + +{% for item in items %} + <h2{{ item.attributes.addClass(classes, 'h3') }}>{{ item.content }}</h2> +{% endfor %} diff --git a/drupal_cms_olivero/templates/field/field--node--field-project--client-link--project--default.html.twig b/drupal_cms_olivero/templates/field/field--node--field-project--client-link--project--default.html.twig new file mode 100644 index 000000000..9bf9f8766 --- /dev/null +++ b/drupal_cms_olivero/templates/field/field--node--field-project--client-link--project--default.html.twig @@ -0,0 +1,37 @@ +{# +/** + * @file + * Theme override for the case study content type's client link field. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - label_hidden: Whether to show the field label or not. + * - title_attributes: HTML attributes for the title. + * - label: The label for the field. + * - multiple: TRUE if a field can contain multiple items. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item's content. + * - entity_type: The entity type to which the field belongs. + * - field_name: The name of the field. + * - field_type: The type of the field. + * - label_display: The display settings for the label. + * + * + * @see template_preprocess_field() + */ +#} + +{% + set classes = [ + 'field', + 'field--name-' ~ field_name|clean_class, + 'field--type-' ~ field_type|clean_class, + 'field--label-' ~ label_display, + label_display == 'inline' ? 'clearfix', + ] +%} + +{% for item in items %} + <div{{ item.attributes.addClass(classes) }}>{{ item.content|add_class('button button--link button--external') }}</div> +{% endfor %} diff --git a/drupal_cms_olivero/templates/field/field--node--field-project--client-name--project--default.html.twig b/drupal_cms_olivero/templates/field/field--node--field-project--client-name--project--default.html.twig new file mode 100644 index 000000000..1873c16d3 --- /dev/null +++ b/drupal_cms_olivero/templates/field/field--node--field-project--client-name--project--default.html.twig @@ -0,0 +1,37 @@ +{# +/** + * @file + * Theme override for the case study content type's name field. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - label_hidden: Whether to show the field label or not. + * - title_attributes: HTML attributes for the title. + * - label: The label for the field. + * - multiple: TRUE if a field can contain multiple items. + * - items: List of all the field items. Each item contains: + * - attributes: List of HTML attributes for each item. + * - content: The field item's content. + * - entity_type: The entity type to which the field belongs. + * - field_name: The name of the field. + * - field_type: The type of the field. + * - label_display: The display settings for the label. + * + * + * @see template_preprocess_field() + */ +#} + +{% + set classes = [ + 'field', + 'field--name-' ~ field_name|clean_class, + 'field--type-' ~ field_type|clean_class, + 'field--label-' ~ label_display, + label_display == 'inline' ? 'clearfix', + ] +%} + +{% for item in items %} + <h2{{ item.attributes.addClass(classes, 'h3') }}>{{ item.content }}</h2> +{% endfor %} diff --git a/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php index 53f8ab62e..881f38111 100644 --- a/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_blog\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -36,6 +37,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'blog'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'blog' => [ 'title' => [ diff --git a/recipes/drupal_cms_case_study/config/core.entity_form_display.node.case_study.default.yml b/recipes/drupal_cms_case_study/config/core.entity_form_display.node.case_study.default.yml index 2704e739f..30b429b97 100644 --- a/recipes/drupal_cms_case_study/config/core.entity_form_display.node.case_study.default.yml +++ b/recipes/drupal_cms_case_study/config/core.entity_form_display.node.case_study.default.yml @@ -2,44 +2,36 @@ langcode: en status: true dependencies: config: - - field.field.node.case_study.field_content - field.field.node.case_study.field_case_study__client_link - field.field.node.case_study.field_case_study__client_logo - field.field.node.case_study.field_case_study__client_name + - field.field.node.case_study.field_content - field.field.node.case_study.field_description - field.field.node.case_study.field_featured_image - field.field.node.case_study.field_tags - node.type.case_study - workflows.workflow.basic_editorial module: + - content_moderation - link - media_library - path - - text - - content_moderation - scheduler + - text id: node.case_study.default targetEntityType: node bundle: case_study mode: default content: - field_content: - type: text_textarea - weight: 3 - region: content - settings: - rows: 9 - placeholder: '' - third_party_settings: { } created: type: datetime_timestamp - weight: 10 + weight: 13 region: content settings: { } third_party_settings: { } field_case_study__client_link: type: link_default - weight: 7 + weight: 10 region: content settings: placeholder_url: '' @@ -47,22 +39,30 @@ content: third_party_settings: { } field_case_study__client_logo: type: media_library_widget - weight: 6 + weight: 9 region: content settings: media_types: { } third_party_settings: { } field_case_study__client_name: type: string_textfield - weight: 5 + weight: 8 region: content settings: size: 60 placeholder: '' third_party_settings: { } + field_content: + type: text_textarea + weight: 7 + region: content + settings: + rows: 9 + placeholder: '' + third_party_settings: { } field_description: type: string_textarea - weight: 1 + weight: 6 region: content settings: rows: 5 @@ -70,14 +70,14 @@ content: third_party_settings: { } field_featured_image: type: media_library_widget - weight: 2 + weight: 5 region: content settings: media_types: { } third_party_settings: { } field_tags: type: entity_reference_autocomplete_tags - weight: 4 + weight: 11 region: content settings: match_operator: CONTAINS @@ -85,35 +85,28 @@ content: size: 60 placeholder: '' third_party_settings: { } - langcode: - type: language_select - weight: 8 - region: content - settings: - include_locked: true - third_party_settings: { } moderation_state: type: moderation_state_default - weight: -7 + weight: 0 region: content settings: { } third_party_settings: { } path: type: path - weight: 13 + weight: 16 region: content settings: { } third_party_settings: { } promote: type: boolean_checkbox - weight: 11 + weight: 14 region: content settings: display_label: true third_party_settings: { } publish_on: type: datetime_timestamp_no_default - weight: -5 + weight: 2 region: content settings: { } third_party_settings: { } @@ -124,27 +117,27 @@ content: settings: { } third_party_settings: { } scheduler_settings: - weight: -6 + weight: 1 region: content settings: { } third_party_settings: { } status: type: boolean_checkbox - weight: 15 + weight: 17 region: content settings: display_label: true third_party_settings: { } sticky: type: boolean_checkbox - weight: 12 + weight: 15 region: content settings: display_label: true third_party_settings: { } title: type: string_textfield - weight: 0 + weight: 4 region: content settings: size: 60 @@ -152,7 +145,7 @@ content: third_party_settings: { } uid: type: entity_reference_autocomplete - weight: 9 + weight: 12 region: content settings: match_operator: CONTAINS @@ -162,7 +155,7 @@ content: third_party_settings: { } unpublish_on: type: datetime_timestamp_no_default - weight: -3 + weight: 3 region: content settings: { } third_party_settings: { } diff --git a/recipes/drupal_cms_case_study/config/core.entity_view_display.node.case_study.default.yml b/recipes/drupal_cms_case_study/config/core.entity_view_display.node.case_study.default.yml index 5732207e6..3033c79b6 100644 --- a/recipes/drupal_cms_case_study/config/core.entity_view_display.node.case_study.default.yml +++ b/recipes/drupal_cms_case_study/config/core.entity_view_display.node.case_study.default.yml @@ -9,6 +9,8 @@ dependencies: - field.field.node.case_study.field_description - field.field.node.case_study.field_featured_image - field.field.node.case_study.field_tags + - image.style.uncropped_300w_webp + - image.style.uncropped_500w_webp - node.type.case_study module: - layout_builder @@ -45,19 +47,22 @@ third_party_settings: settings: view_mode: hero third_party_settings: { } - weight: 1 + weight: 3 additional: { } df925eef-8afb-4f9a-8431-415d5b28e3c1: uuid: df925eef-8afb-4f9a-8431-415d5b28e3c1 region: content configuration: id: 'field_block:node:case_study:field_tags' + label: Tags label_display: '0' + provider: layout_builder context_mapping: entity: layout_builder.entity + view_mode: view_mode formatter: type: entity_reference_label - label: hidden + label: inline settings: link: true third_party_settings: { } @@ -71,7 +76,7 @@ third_party_settings: label_display: '0' context_mapping: entity: layout_builder.entity - weight: 2 + weight: 4 additional: { } 739968bb-5952-482a-a215-9a642ef92064: uuid: 739968bb-5952-482a-a215-9a642ef92064 @@ -86,29 +91,30 @@ third_party_settings: label: hidden settings: { } third_party_settings: { } - weight: 6 + weight: 5 additional: { } - ac86ac5e-6b08-49e4-8ea7-b32f8be8084e: - uuid: ac86ac5e-6b08-49e4-8ea7-b32f8be8084e + 60cbfb7f-7ffb-4456-9488-6adc0c101abb: + uuid: 60cbfb7f-7ffb-4456-9488-6adc0c101abb region: content configuration: - id: 'field_block:node:case_study:field_case_study__client_logo' - label: 'Client logo' + id: 'field_block:node:case_study:field_case_study__client_link' + label: 'Client link' label_display: '0' provider: layout_builder context_mapping: entity: layout_builder.entity view_mode: view_mode formatter: - type: media_thumbnail + type: link label: hidden settings: - image_link: '' - image_style: uncropped_500w_webp - image_loading: - attribute: lazy + trim_length: 80 + url_only: false + url_plain: false + rel: '0' + target: _blank third_party_settings: { } - weight: 3 + weight: 6 additional: { } 996432cc-5668-42b7-a2f3-2b3977b390c4: uuid: 996432cc-5668-42b7-a2f3-2b3977b390c4 @@ -127,30 +133,29 @@ third_party_settings: settings: link_to_entity: false third_party_settings: { } - weight: 4 + weight: 2 additional: { } - 60cbfb7f-7ffb-4456-9488-6adc0c101abb: - uuid: 60cbfb7f-7ffb-4456-9488-6adc0c101abb + ac86ac5e-6b08-49e4-8ea7-b32f8be8084e: + uuid: ac86ac5e-6b08-49e4-8ea7-b32f8be8084e region: content configuration: - id: 'field_block:node:case_study:field_case_study__client_link' - label: 'Client link' + id: 'field_block:node:case_study:field_case_study__client_logo' + label: 'Client logo' label_display: '0' provider: layout_builder context_mapping: entity: layout_builder.entity view_mode: view_mode formatter: - type: link + type: media_thumbnail label: hidden settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '0' - target: _blank + image_link: '' + image_style: uncropped_300w_webp + image_loading: + attribute: lazy third_party_settings: { } - weight: 5 + weight: 1 additional: { } third_party_settings: { } id: node.case_study.default @@ -220,5 +225,4 @@ content: region: content hidden: field_description: true - langcode: true links: true diff --git a/recipes/drupal_cms_case_study/config/field.field.node.case_study.field_case_study__client_link.yml b/recipes/drupal_cms_case_study/config/field.field.node.case_study.field_case_study__client_link.yml index ac7aac9ab..f38da563b 100644 --- a/recipes/drupal_cms_case_study/config/field.field.node.case_study.field_case_study__client_link.yml +++ b/recipes/drupal_cms_case_study/config/field.field.node.case_study.field_case_study__client_link.yml @@ -17,6 +17,6 @@ translatable: false default_value: { } default_value_callback: '' settings: - title: 0 + title: 1 link_type: 17 field_type: link diff --git a/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php index 43635156f..50cf3ed41 100644 --- a/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_case_study\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -36,6 +37,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'case_study'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'case_study' => [ 'title' => [ diff --git a/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php index 591299b9e..8278a09fe 100644 --- a/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_events\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -43,6 +44,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'event'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'event' => [ 'title' => [ diff --git a/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php index 67cb61ba9..2c66482cd 100644 --- a/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_news\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -41,6 +42,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'news'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'news' => [ 'title' => [ diff --git a/recipes/drupal_cms_page/config/core.entity_form_display.node.page.default.yml b/recipes/drupal_cms_page/config/core.entity_form_display.node.page.default.yml index d3a6ce6c4..cca59903b 100644 --- a/recipes/drupal_cms_page/config/core.entity_form_display.node.page.default.yml +++ b/recipes/drupal_cms_page/config/core.entity_form_display.node.page.default.yml @@ -140,11 +140,6 @@ content: region: content settings: { } third_party_settings: { } - url_redirects: - weight: 15 - region: content - settings: { } - third_party_settings: { } hidden: layout_builder__layout: true publish_state: true diff --git a/recipes/drupal_cms_page/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_page/tests/src/Functional/ComponentValidationTest.php index 192cae07f..e53c0583a 100644 --- a/recipes/drupal_cms_page/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_page/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_page\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -29,6 +30,11 @@ class ComponentValidationTest extends BrowserTestBase { // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'page'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'page' => [ 'title' => [ diff --git a/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php index 915944a81..a266d6042 100644 --- a/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_person\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -36,6 +37,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'person'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'person' => [ 'title' => [ diff --git a/recipes/drupal_cms_project/config/core.entity_form_display.node.project.default.yml b/recipes/drupal_cms_project/config/core.entity_form_display.node.project.default.yml index 99e40957d..a99a9516f 100644 --- a/recipes/drupal_cms_project/config/core.entity_form_display.node.project.default.yml +++ b/recipes/drupal_cms_project/config/core.entity_form_display.node.project.default.yml @@ -3,26 +3,32 @@ status: true dependencies: config: - field.field.node.project.field_content + - field.field.node.project.field_description + - field.field.node.project.field_featured_image - field.field.node.project.field_project__client_link - field.field.node.project.field_project__client_logo - field.field.node.project.field_project__client_name - - field.field.node.project.field_description - - field.field.node.project.field_featured_image - field.field.node.project.field_tags - node.type.project - workflows.workflow.basic_editorial module: + - content_moderation - link - media_library - path - - text - - content_moderation - scheduler + - text id: node.project.default targetEntityType: node bundle: project mode: default content: + created: + type: datetime_timestamp + weight: 13 + region: content + settings: { } + third_party_settings: { } field_content: type: text_textarea weight: 7 @@ -31,15 +37,24 @@ content: rows: 9 placeholder: '' third_party_settings: { } - created: - type: datetime_timestamp - weight: 10 + field_description: + type: string_textarea + weight: 6 region: content - settings: { } + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + field_featured_image: + type: media_library_widget + weight: 5 + region: content + settings: + media_types: { } third_party_settings: { } field_project__client_link: type: link_default - weight: 6 + weight: 10 region: content settings: placeholder_url: '' @@ -47,37 +62,22 @@ content: third_party_settings: { } field_project__client_logo: type: media_library_widget - weight: 5 + weight: 9 region: content settings: media_types: { } third_party_settings: { } field_project__client_name: type: string_textfield - weight: 4 + weight: 8 region: content settings: size: 60 placeholder: '' third_party_settings: { } - field_description: - type: string_textarea - weight: 1 - region: content - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - field_featured_image: - type: media_library_widget - weight: 2 - region: content - settings: - media_types: { } - third_party_settings: { } field_tags: type: entity_reference_autocomplete_tags - weight: 3 + weight: 11 region: content settings: match_operator: CONTAINS @@ -85,35 +85,28 @@ content: size: 60 placeholder: '' third_party_settings: { } - langcode: - type: language_select - weight: 8 - region: content - settings: - include_locked: true - third_party_settings: { } moderation_state: type: moderation_state_default - weight: -7 + weight: 0 region: content settings: { } third_party_settings: { } path: type: path - weight: 13 + weight: 16 region: content settings: { } third_party_settings: { } promote: type: boolean_checkbox - weight: 11 + weight: 14 region: content settings: display_label: true third_party_settings: { } publish_on: type: datetime_timestamp_no_default - weight: -5 + weight: 2 region: content settings: { } third_party_settings: { } @@ -124,27 +117,27 @@ content: settings: { } third_party_settings: { } scheduler_settings: - weight: -6 + weight: 1 region: content settings: { } third_party_settings: { } status: type: boolean_checkbox - weight: 15 + weight: 17 region: content settings: display_label: true third_party_settings: { } sticky: type: boolean_checkbox - weight: 12 + weight: 15 region: content settings: display_label: true third_party_settings: { } title: type: string_textfield - weight: 0 + weight: 4 region: content settings: size: 60 @@ -152,7 +145,7 @@ content: third_party_settings: { } uid: type: entity_reference_autocomplete - weight: 9 + weight: 12 region: content settings: match_operator: CONTAINS @@ -162,7 +155,7 @@ content: third_party_settings: { } unpublish_on: type: datetime_timestamp_no_default - weight: -3 + weight: 3 region: content settings: { } third_party_settings: { } diff --git a/recipes/drupal_cms_project/config/core.entity_view_display.node.project.default.yml b/recipes/drupal_cms_project/config/core.entity_view_display.node.project.default.yml index 84d241bed..2164740e2 100644 --- a/recipes/drupal_cms_project/config/core.entity_view_display.node.project.default.yml +++ b/recipes/drupal_cms_project/config/core.entity_view_display.node.project.default.yml @@ -46,7 +46,7 @@ third_party_settings: settings: view_mode: hero third_party_settings: { } - weight: 0 + weight: 2 additional: { } 43e820d8-dd02-49c6-8239-34b146f1b568: uuid: 43e820d8-dd02-49c6-8239-34b146f1b568 @@ -72,7 +72,7 @@ third_party_settings: label_display: '0' context_mapping: entity: layout_builder.entity - weight: 1 + weight: 3 additional: { } 811ba61b-54fa-4d59-9c75-245d66da3d99: uuid: 811ba61b-54fa-4d59-9c75-245d66da3d99 @@ -87,7 +87,7 @@ third_party_settings: label: hidden settings: { } third_party_settings: { } - weight: 6 + weight: 5 additional: { } 635918ab-08d4-46e3-8312-b5c64d8e4752: uuid: 635918ab-08d4-46e3-8312-b5c64d8e4752 @@ -105,11 +105,11 @@ third_party_settings: label: hidden settings: image_link: '' - image_style: uncropped_500w_webp + image_style: uncropped_300w_webp image_loading: attribute: lazy third_party_settings: { } - weight: 2 + weight: 0 additional: { } 004263b2-05d9-4c2a-b7d2-4ef9394bb5c3: uuid: 004263b2-05d9-4c2a-b7d2-4ef9394bb5c3 @@ -128,7 +128,7 @@ third_party_settings: settings: link_to_entity: false third_party_settings: { } - weight: 3 + weight: 1 additional: { } ae32e8a9-44e7-433f-8c1f-931fe9497565: uuid: ae32e8a9-44e7-433f-8c1f-931fe9497565 @@ -151,7 +151,7 @@ third_party_settings: rel: '0' target: _blank third_party_settings: { } - weight: 5 + weight: 6 additional: { } third_party_settings: { } id: node.project.default @@ -177,7 +177,7 @@ content: settings: view_mode: hero link: false - third_party_settings: { } + third_party_settings: { } weight: 0 region: content field_project__client_link: @@ -221,5 +221,4 @@ content: region: content hidden: field_description: true - langcode: true links: true diff --git a/recipes/drupal_cms_project/config/field.field.node.project.field_project__client_link.yml b/recipes/drupal_cms_project/config/field.field.node.project.field_project__client_link.yml index 7b948d090..05e5b1192 100644 --- a/recipes/drupal_cms_project/config/field.field.node.project.field_project__client_link.yml +++ b/recipes/drupal_cms_project/config/field.field.node.project.field_project__client_link.yml @@ -17,6 +17,6 @@ translatable: false default_value: { } default_value_callback: '' settings: - title: 0 + title: 1 link_type: 17 field_type: link diff --git a/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php index 9600f91b9..a65d0f992 100644 --- a/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_project\Functional; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; use Drupal\Tests\BrowserTestBase; @@ -36,6 +37,11 @@ class ComponentValidationTest extends BrowserTestBase { } public function testContentModel(): void { + $form_display = $this->container->get(EntityDisplayRepositoryInterface::class) + ->getFormDisplay('node', 'project'); + $this->assertFalse($form_display->isNew()); + $this->assertNull($form_display->getComponent('url_redirects')); + $this->assertContentModel([ 'project' => [ 'title' => [ -- GitLab