protected function ContentEntityCloneBase::fieldIsClonable in Entity Clone 8
Determines if a field is clonable.
Parameters
\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 in src/
EntityClone/ Content/ ContentEntityCloneBase.php - Clone an entity.
File
- src/
EntityClone/ Content/ ContentEntityCloneBase.php, line 128
Class
- ContentEntityCloneBase
- Class ContentEntityCloneBase.
Namespace
Drupal\entity_clone\EntityClone\ContentCode
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;
}