function EntityNodeType::getEntity

Same name and namespace in other branches
  1. 11.x core/modules/node/src/Plugin/migrate/destination/EntityNodeType.php \Drupal\node\Plugin\migrate\destination\EntityNodeType::getEntity()

Creates or loads an entity.

Parameters

\Drupal\migrate\Row $row: The row object.

array $old_destination_id_values: The old destination IDs.

Return value

\Drupal\Core\Entity\EntityInterface The entity we are importing into.

Overrides Entity::getEntity

File

core/modules/node/src/Plugin/migrate/destination/EntityNodeType.php, line 18

Class

EntityNodeType
Migration destination for node type entity.

Namespace

Drupal\node\Plugin\migrate\destination

Code

public function getEntity(Row $row, array $old_destination_id_values) {
  /** @var \Drupal\node\NodeTypeInterface $node_type */
  $node_type = parent::getEntity($row, $old_destination_id_values);
  // Config schema does not allow description or help text to be empty.
  if ($node_type->getDescription() === '') {
    $node_type->set('description', NULL);
  }
  if ($node_type->getHelp() === '') {
    $node_type->set('help', NULL);
  }
  return $node_type;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.