function NodeModerationHandler::enforceRevisionsBundleFormAlter

Same name in other branches
  1. 9 core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter()
  2. 8.9.x core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter()
  3. 10 core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler::enforceRevisionsBundleFormAlter()

Overrides ModerationHandler::enforceRevisionsBundleFormAlter

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.