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

Determines if a field is clonable.

Paramètres

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

bool TRUE if the field is clonable; FALSE otherwise.

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

Fichier

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

Classe

ContentEntityCloneBase
Class Content Entity Clone Base.

Namespace

Drupal\entity_clone\EntityClone\Content

Code

protected function fieldIsClonable(FieldDefinitionInterface $field_definition) {
    $clonable_field_types = [
        'entity_reference',
        'entity_reference_revisions',
    ];
    $type_is_clonable = in_array($field_definition->getType(), $clonable_field_types, TRUE);
    if ($field_definition instanceof FieldConfigInterface && $type_is_clonable) {
        return TRUE;
    }
    return FALSE;
}