You are here

BlockContentModerationHandler.php in Workbench Moderation 8

Same filename and directory in other branches
  1. 8.2 src/Entity/Handler/BlockContentModerationHandler.php

File

src/Entity/Handler/BlockContentModerationHandler.php
View source
<?php

namespace Drupal\workbench_moderation\Entity\Handler;

use Drupal\Core\Form\FormStateInterface;

/**
 * Customizations for block content entities.
 */
class BlockContentModerationHandler extends ModerationHandler {

  /**
   * {@inheritdoc}
   */
  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.');
  }

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

}

Classes

Namesort descending Description
BlockContentModerationHandler Customizations for block content entities.