You are here

public function BlockContentModerationHandler::enforceRevisionsEntityFormAlter in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Handler/BlockContentModerationHandler.php \Drupal\workbench_moderation\Entity\Handler\BlockContentModerationHandler::enforceRevisionsEntityFormAlter()

Alters entity forms to enforce revision handling.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string $form_id: The form id.

Overrides ModerationHandler::enforceRevisionsEntityFormAlter

See also

hook_form_alter()

File

src/Entity/Handler/BlockContentModerationHandler.php, line 15

Class

BlockContentModerationHandler
Customizations for block content entities.

Namespace

Drupal\workbench_moderation\Entity\Handler

Code

public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id) {
  $form['revision_information']['revision']['#default_value'] = TRUE;
  $form['revision_information']['revision']['#disabled'] = TRUE;
  $form['revision_information']['revision']['#description'] = $this
    ->t('Revisions must be required when moderation is enabled.');
}