BlockContentModerationHandler.php in Drupal 10
File
core/modules/content_moderation/src/Entity/Handler/BlockContentModerationHandler.php
View source
<?php
namespace Drupal\content_moderation\Entity\Handler;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Form\FormStateInterface;
class BlockContentModerationHandler extends ModerationHandler {
public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id) {
$form['revision']['#default_value'] = TRUE;
$form['revision']['#disabled'] = TRUE;
$form['revision']['#description'] = $this
->t('Revisions must be required when moderation is enabled.');
}
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.');
}
public function isModeratedEntity(ContentEntityInterface $entity) {
return $entity
->isReusable();
}
}