class ConfigEntityRevisionsModerationHandler in Config Entity Revisions 8
Same name and namespace in other branches
- 8.2 src/Entity/Handler/ConfigEntityRevisionsModerationHandler.php \Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsModerationHandler
- 1.x src/Entity/Handler/ConfigEntityRevisionsModerationHandler.php \Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsModerationHandler
Customizations for config_entity_revisions entities.
Hierarchy
- class \Drupal\content_moderation\Entity\Handler\ModerationHandler implements ModerationHandlerInterface, EntityHandlerInterface uses StringTranslationTrait
- class \Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsModerationHandler
Expanded class hierarchy of ConfigEntityRevisionsModerationHandler
File
- src/
Entity/ Handler/ ConfigEntityRevisionsModerationHandler.php, line 19 - Contains Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsModerationHandler.
Namespace
Drupal\config_entity_revisions\Entity\HandlerView source
class ConfigEntityRevisionsModerationHandler extends ModerationHandler {
/**
* The moderation information service.
*
* @var ModerationInformationInterface
*/
protected $moderationInfo;
/**
* NodeModerationHandler constructor.
*
* @param 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 onPresave(ContentEntityInterface $entity, $default_revision, $published_state) {
// Updating an existing revision?
if (!$entity
->isNewRevision()) {
return;
}
$entity
->setNewRevision(TRUE);
$entity
->isDefaultRevision($default_revision);
// Update publishing status if it can be updated and if it needs updating.
if ($entity instanceof EntityPublishedInterface && $entity
->isPublished() !== $published_state) {
$published_state ? $entity
->setPublished() : $entity
->setUnpublished();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEntityRevisionsModerationHandler:: |
protected | property | The moderation information service. | |
ConfigEntityRevisionsModerationHandler:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides ModerationHandler:: |
|
ConfigEntityRevisionsModerationHandler:: |
public | function |
Operates on moderated content entities preSave(). Overrides ModerationHandler:: |
|
ConfigEntityRevisionsModerationHandler:: |
public | function | NodeModerationHandler constructor. | |
ModerationHandler:: |
public | function |
Alters bundle forms to enforce revision handling. Overrides ModerationHandlerInterface:: |
2 |
ModerationHandler:: |
public | function |
Alters entity forms to enforce revision handling. Overrides ModerationHandlerInterface:: |
2 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |