You are here

public function Entity::getBundle in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::getBundle()
  2. 10 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::getBundle()

Gets the bundle for the row taking into account the default.

Parameters

\Drupal\migrate\Row $row: The current row we're importing.

Return value

string The bundle for this row.

2 calls to Entity::getBundle()
Entity::getEntity in core/modules/migrate/src/Plugin/migrate/destination/Entity.php
Creates or loads an entity.
EntityContentComplete::getEntity in core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php
Gets the entity.

File

core/modules/migrate/src/Plugin/migrate/destination/Entity.php, line 131

Class

Entity
Provides a generic destination to import entities.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function getBundle(Row $row) {
  $default_bundle = isset($this->configuration['default_bundle']) ? $this->configuration['default_bundle'] : '';
  $bundle_key = $this
    ->getKey('bundle');
  return $row
    ->getDestinationProperty($bundle_key) ?: $default_bundle;
}