- Issue created by @koosvdkolk
It feels to me that the words 'entity' and 'content' would benefit from a more clear definition in the code/the documentation.
To me, the 'entity' is the 'content' I am trying to export/import.
This makes the following code e.g. confusing:
/**
* Constructs a new ImportEvent object.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity being imported. Could be either a new or existing entity.
* @param array $content
* The content to import.
*/
public function __construct(ContentEntityInterface $entity, array $content) {
$this->entity = $entity;
$this->content = $content;
}
If I would like to alter something, should I alter the $entity object, the $content array, or both?
Another example: on https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... → it says:
switch ($entity->bundle()) {
case 'gpx':
// Change bundle for original export.
if (!$is_translation) {
$output['bundle'] = 'file';
}
break;
}
Why use $entity->bundle(), as $output['bundle'] also has the bundle?
Active
1.4
Documentation