/** * Check if an entity's default revision and/or state needs adjusting. * * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity to check. * @param bool $published_state * Whether the state being transitioned to is a published state or not. * * @return bool * TRUE when either the default revision or the state needs to be updated. */ 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; }