Skip to content

Commit

Permalink
VACMS-15242: Adjust form structure of promo block to address revision…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
chri5tia authored Sep 27, 2023
1 parent 46d250f commit 3619568
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,7 +65,7 @@ content:
third_party_settings: { }
moderation_state:
type: moderation_state_default
weight: 3
weight: 5
region: content
settings: { }
third_party_settings: { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 6 additions & 9 deletions tests/cypress/support/main_content_blocks.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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();
});

0 comments on commit 3619568

Please sign in to comment.