You are here

protected function ContentEntityCloneBase::getChildProperties in Entity Clone 8

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 219

Class

ContentEntityCloneBase
Class ContentEntityCloneBase.

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