protected NodeModerationHandler::shouldModerate(ContentEntityInterface $entity, $published_state)
Check if an entity's default revision and/or state needs adjusting.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to check.
bool $published_state: Whether the state being transitioned to is a published state or not.
Return value
bool TRUE when either the default revision or the state needs to be updated.
File
- core/modules/content_moderation/src/Entity/Handler/NodeModerationHandler.php, line 59
Class
- NodeModerationHandler
- Customizations for node entities.
Namespace
Drupal\content_moderation\Entity\Handler
Code
1 2 3 4 5 6 | protected function shouldModerate(ContentEntityInterface $entity , $published_state ) { // @todo clarify the first condition. // First condition is needed so you can add a translation. // Second condition checks to see if the published status has changed. return $entity ->isDefaultTranslation() || $entity ->isPublished() !== $published_state ; } |
Please login to continue.