From 3619568a1b683bf9b5dce12158ef1c9f47a4b8e1 Mon Sep 17 00:00:00 2001 From: Christia Troyer Date: Wed, 27 Sep 2023 13:21:27 -0700 Subject: [PATCH] VACMS-15242: Adjust form structure of promo block to address revision log issues (#15355) * VACMS-15242: Makes changes to require revision log message to be more inclusive * VACMS-15242: Don't unset the revision log states * VACMS-15242: Remove submit from media feature test * VACMS-15242: Separate some chained queries * VACMS-15242: Accommodate cms announcement blocks as well and put state unset back in so it will work * VACMS-15242: Removing unsafe safety check * VACMS-15242: Change the promo block architecture to match the others * VACMS-15242: Rearrange order of fields in promo --- ...rm_display.block_content.promo.default.yml | 22 ++++++++++++++++++- .../EventSubscriber/EntityEventSubscriber.php | 12 ---------- tests/cypress/support/main_content_blocks.js | 15 +++++-------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/config/sync/core.entity_form_display.block_content.promo.default.yml b/config/sync/core.entity_form_display.block_content.promo.default.yml index 47161e4af1..a917dc0870 100644 --- a/config/sync/core.entity_form_display.block_content.promo.default.yml +++ b/config/sync/core.entity_form_display.block_content.promo.default.yml @@ -10,8 +10,28 @@ dependencies: - workflows.workflow.editorial module: - content_moderation + - field_group - inline_entity_form - media_library +third_party_settings: + field_group: + group_section_settings: + children: + - field_owner + - moderation_state + - revision_log + label: 'Section settings' + region: content + parent_name: '' + weight: 2 + format_type: fieldset + format_settings: + classes: '' + show_empty_fields: false + id: '' + description: '' + required_fields: true + description_display: after id: block_content.promo.default targetEntityType: block_content bundle: promo @@ -45,7 +65,7 @@ content: third_party_settings: { } moderation_state: type: moderation_state_default - weight: 3 + weight: 5 region: content settings: { } third_party_settings: { } diff --git a/docroot/modules/custom/va_gov_workflow/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_workflow/src/EventSubscriber/EntityEventSubscriber.php index 097f1bfa01..51ff961dff 100644 --- a/docroot/modules/custom/va_gov_workflow/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_workflow/src/EventSubscriber/EntityEventSubscriber.php @@ -2,7 +2,6 @@ namespace Drupal\va_gov_workflow\EventSubscriber; -use Drupal\block_content\BlockContentInterface; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityFormInterface; use Drupal\Core\Entity\EntityInterface; @@ -266,17 +265,6 @@ public function entityDelete(EntityDeleteEvent $event): void { * The form id. */ public function requireRevisionMessage(array &$form, FormStateInterface &$form_state, $form_id) { - // Check if the block-content form is of type promo and exit (#15187) - $formObject = $form_state->getFormObject(); - if ($formObject instanceof EntityFormInterface) { - $entity = $formObject->getEntity(); - if ($entity instanceof BlockContentInterface) { - if ($entity->bundle() === 'promo') { - return; - } - } - } - $form['revision_log']['#required'] = TRUE; $form['revision_log']['widget']['#required'] = TRUE; $form['revision_log']['widget'][0]['#required'] = TRUE; diff --git a/tests/cypress/support/main_content_blocks.js b/tests/cypress/support/main_content_blocks.js index 1b9c67cd62..6dd04b3558 100644 --- a/tests/cypress/support/main_content_blocks.js +++ b/tests/cypress/support/main_content_blocks.js @@ -1,10 +1,9 @@ import { faker } from "@faker-js/faker"; Cypress.Commands.add("addMainContentBlockWithRichText", (text) => { - cy.get("#edit-field-content-block-add-more-browse") - .scrollIntoView() - .should("be.visible") - .click(); + cy.get("#edit-field-content-block-add-more-browse").scrollIntoView(); + cy.get("#edit-field-content-block-add-more-browse").should("be.visible"); + cy.get("#edit-field-content-block-add-more-browse").click(); cy.wait(1000); cy.get("div#drupal-modal").within(() => { cy.wait(1000); @@ -18,10 +17,9 @@ Cypress.Commands.add("addMainContentBlockWithRichText", (text) => { }); Cypress.Commands.add("addMainContentBlockWithFile", (type) => { - cy.get("#edit-field-content-block-add-more-browse") - .scrollIntoView() - .should("be.visible") - .click(); + cy.get("#edit-field-content-block-add-more-browse").scrollIntoView(); + cy.get("#edit-field-content-block-add-more-browse").should("be.visible"); + cy.get("#edit-field-content-block-add-more-browse").click(); cy.wait(1000); cy.get("div#drupal-modal").within(() => { cy.wait(1000); @@ -51,5 +49,4 @@ Cypress.Commands.add("addMainContentBlockWithFile", (type) => { `[Test Data] ${faker.lorem.sentence()}`, { force: true } ); - cy.get("form.node-form").find("input#edit-submit").click(); });