Same name and namespace in other branches
  1. 2.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.

Paramètres

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

Return value

bool Whether it can be moderated.

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

Fichier

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

Classe

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));
}