diff --git a/drupal_cms_olivero/css/base/buttons.css b/drupal_cms_olivero/css/base/buttons.css index 77e60e07b57a127141ea47a34ecd695d24fc8a5e..1b4c2c1a04ad10d81d62c26c1ac588a68caf62e0 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 fbe0dcb764865b1e1033db471da50acc5e7e6d57..71c3b9963aa53fb8f89360794c65f870def3ac24 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 0000000000000000000000000000000000000000..6c2e89e797598552243cc1c151dfdcaf0c10bbb0 --- /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 0000000000000000000000000000000000000000..6009655ea33e0544bb77a85d45dda795e30cc90e --- /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 c85573eae1b7ba1da61d954c0b22b34e880778c1..c9f18f5322888ed14e30a0304755afdc85aaa3fe 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 f4e5d066d8f529e8b80ed753f55194f49dab345e..43059a137fd78de881271c75be33b0142fcebe62 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 0000000000000000000000000000000000000000..9bf9f87662af3d80e349f7320e3ba985f07facf9 --- /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 0000000000000000000000000000000000000000..1873c16d3f2dab356a7bc41abefe8e1102308f29 --- /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 0000000000000000000000000000000000000000..9bf9f87662af3d80e349f7320e3ba985f07facf9 --- /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 0000000000000000000000000000000000000000..1873c16d3f2dab356a7bc41abefe8e1102308f29 --- /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 53f8ab62edfda8e3621bc294dbe069fa46d64a18..881f38111683cb5e5e934c6ec62f43b430f5c6da 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 2704e739fac545d31847b6c528c6359cfd89d370..30b429b97b567e246cdeeee05c45b92d8a783c67 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 5732207e6769219a704cfd51aefec9950fb29399..3033c79b6bf74e0888ef5f2a9db9012bf46e3aa3 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 ac7aac9abfb44c946ad4984c21b1fe29ee64af2e..f38da563b2288ef1989027f15b06f3f4740535e3 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 43635156f5671f4a1c4c361efc7229be79489a43..50cf3ed4110eb2b99e06562f52f71e65281f673e 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 591299b9e1332ddef58fe91ba0ab5b270d3cec54..8278a09fe440c1298c24b02614a88f2866644025 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 67cb61ba95ff52989024caca38ee15040fb6a5b5..2c66482cd5d0e83ffbc923854c482a90a2194095 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 d3a6ce6c46a33f4a6126d19028b05a9f19dcd828..cca59903b43e3b9bcbad19e5741adfca86865167 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 192cae07f2f74f3609d830c1c8e34d9209a56bd6..e53c0583a0ecc7ea8f7e13122e41459fdcea4128 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 915944a816fa46ffe8a4cfb3006befebcddce23d..a266d6042e6fe1fe2f25a6b9c84233988acd0e30 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 99e40957d01024df323739ea43c037803251bb1b..a99a9516f92ae74c08851ee83a0b6ce9da0a4068 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 84d241bedf5bf5a7df693d3672bdfb917e134029..2164740e2c2fca47e0c77ff7a8afeb2d211de708 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 7b948d0902c15bb557083ecab0f08e67590c0366..05e5b1192c5170441455e272aeb22d7bc50bd676 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 9600f91b913f78ac5684628443b83de671ec588f..a65d0f9924249c5a320be18f25d17053b4f91ce2 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' => [