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

Fetches the properties of a child entity.

Parameters

array $properties: Properties of the clone operation.

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

\Drupal\Core\Entity\EntityInterface $referenced_entity: The field's target entity.

Return value

array Child properties.

1 call to ContentEntityCloneBase::getChildProperties()
ContentEntityCloneBase::cloneReferencedEntities in src/EntityClone/Content/ContentEntityCloneBase.php
Clones referenced entities.

File

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

Class

ContentEntityCloneBase
Class Content Entity Clone Base.

Namespace

Drupal\entity_clone\EntityClone\Content

Code

protected function getChildProperties(array $properties, FieldConfigInterface $field_definition, EntityInterface $referenced_entity) {
    $child_properties = [];
    if (isset($properties['recursive'][$field_definition->id()]['references'][$referenced_entity->id()])) {
        $child_properties = $properties['recursive'][$field_definition->id()]['references'][$referenced_entity->id()];
    }
    if (!isset($child_properties['children'])) {
        $child_properties['children'] = [];
    }
    return $child_properties;
}