class NodeModerationHandler
Same name in other branches
- 9 core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler
- 10 core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler
- 11.x core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php \Drupal\content_moderation\Entity\Handler\NodeModerationHandler
Customizations for node entities.
@internal
Hierarchy
- class \Drupal\content_moderation\Entity\Handler\ModerationHandler implements \Drupal\content_moderation\Entity\Handler\ModerationHandlerInterface, \Drupal\Core\Entity\EntityHandlerInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\content_moderation\Entity\Handler\NodeModerationHandler extends \Drupal\content_moderation\Entity\Handler\ModerationHandler
Expanded class hierarchy of NodeModerationHandler
1 file declares its use of NodeModerationHandler
- EntityTypeInfo.php in core/
modules/ content_moderation/ src/ EntityTypeInfo.php
File
-
core/
modules/ content_moderation/ src/ Entity/ Handler/ NodeModerationHandler.php, line 15
Namespace
Drupal\content_moderation\Entity\HandlerView source
class NodeModerationHandler extends ModerationHandler {
/**
* The moderation information service.
*
* @var \Drupal\content_moderation\ModerationInformationInterface
*/
protected $moderationInfo;
/**
* NodeModerationHandler constructor.
*
* @param \Drupal\content_moderation\ModerationInformationInterface $moderation_info
* The moderation information service.
*/
public function __construct(ModerationInformationInterface $moderation_info) {
$this->moderationInfo = $moderation_info;
}
/**
* {@inheritdoc}
*/
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static($container->get('content_moderation.moderation_information'));
}
/**
* {@inheritdoc}
*/
public function enforceRevisionsEntityFormAlter(array &$form, FormStateInterface $form_state, $form_id) {
$form['revision']['#disabled'] = TRUE;
$form['revision']['#default_value'] = TRUE;
$form['revision']['#description'] = $this->t('Revisions are required.');
}
/**
* {@inheritdoc}
*/
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;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
ModerationHandler::onPresave | public | function | Operates on moderated content entities preSave(). | Overrides ModerationHandlerInterface::onPresave | |
NodeModerationHandler::$moderationInfo | protected | property | The moderation information service. | ||
NodeModerationHandler::createInstance | public static | function | Instantiates a new instance of this entity handler. | Overrides ModerationHandler::createInstance | |
NodeModerationHandler::enforceRevisionsBundleFormAlter | public | function | Alters bundle forms to enforce revision handling. | Overrides ModerationHandler::enforceRevisionsBundleFormAlter | |
NodeModerationHandler::enforceRevisionsEntityFormAlter | public | function | Alters entity forms to enforce revision handling. | Overrides ModerationHandler::enforceRevisionsEntityFormAlter | |
NodeModerationHandler::__construct | public | function | NodeModerationHandler constructor. | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | ||
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.