function Entity::getBundle

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::getBundle()
  2. 8.9.x core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::getBundle()
  3. 11.x 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 142

Class

Entity
Provides a generic destination to import entities.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

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

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