Same name in other branches
  1. 8.x-1.x src/EntityClone/Content/ContentEntityCloneBase.php \Drupal\entity_clone\EntityClone\Content\ContentEntityCloneBase::hasTranslatableModerationState()

Checks if the entity has the moderation state field and can be moderated.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

Return value

bool Whether it can be moderated.

1 call to ContentEntityCloneBase::hasTranslatableModerationState()
ContentEntityCloneBase::cloneEntity in src/EntityClone/Content/ContentEntityCloneBase.php
Clone an entity.

File

src/EntityClone/Content/ContentEntityCloneBase.php, line 339

Class

ContentEntityCloneBase
Class Content Entity Clone Base.

Namespace

Drupal\entity_clone\EntityClone\Content

Code

protected function hasTranslatableModerationState(ContentEntityInterface $entity) : bool {
    if (!$entity->hasField('moderation_state') || !$entity->get('moderation_state') instanceof ModerationStateFieldItemList) {
        return FALSE;
    }
    return !empty($entity->getTranslationLanguages(FALSE));
}