You are here

public function NodeModerationHandler::enforceRevisionsBundleFormAlter in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter()

Alters bundle 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::enforceRevisionsBundleFormAlter

See also

hook_form_alter()

File

core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php, line 55

Class

NodeModerationHandler
Customizations for node entities.

Namespace

Drupal\content_moderation\Entity\Handler

Code

public function enforceRevisionsBundleFormAlter(array &$form, FormStateInterface $form_state, $form_id) {

  // Force the revision checkbox on.
  $form['workflow']['options']['revision']['#value'] = 'revision';
  $form['workflow']['options']['revision']['#disabled'] = TRUE;
}