Skip to content

Commit

Permalink
VACMS-15242: Removing unsafe safety added earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
chri5tia committed Sep 27, 2023
1 parent e1e915a commit 8568955
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
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,25 +265,18 @@ public function entityDelete(EntityDeleteEvent $event): void {
* The form id.
*/
public function requireRevisionMessage(array &$form, FormStateInterface &$form_state, $form_id): void {
// See what kind of form we are dealing with and do some safety checks.
// Hide the checkbox that lets user opt into making a revision.
$formObject = $form_state->getFormObject();
if (!$formObject instanceof EntityFormInterface) {
return;
}
$entity = $formObject->getEntity();
if (!$entity instanceof BlockContentInterface) {
return;
}

// Hide the checkbox that lets you opt into making a revision.
// Promo blocks have a different form structure.
if (in_array($entity->bundle(), ['promo', 'cms_announcement'])) {
if ($entity->bundle() === 'promo') {
// Hide revision checkbox on Promo blocks.
$form["revision_information"]["#access"] = TRUE;
unset($form['revision_log']['#states']);
$form["revision"]["#access"] = FALSE;
$form["revision_log"]["#access"] = TRUE;
}
else {
// Hide revision checkbox on all other custom blocks.
$form["revision_information"]["#attributes"]['class'][] = 'visually-hidden';
$this->bypassRevisionLogValidationOnIef($form, $form_state);
}
Expand Down
1 change: 0 additions & 1 deletion tests/cypress/support/main_content_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,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 8568955

Please sign in to comment.