You are here

protected function EntityBlock::getEntityId in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/src/Plugin/migrate/destination/EntityBlock.php \Drupal\block\Plugin\migrate\destination\EntityBlock::getEntityId()
  2. 9 core/modules/block/src/Plugin/migrate/destination/EntityBlock.php \Drupal\block\Plugin\migrate\destination\EntityBlock::getEntityId()

Gets the entity ID of the row.

Parameters

\Drupal\migrate\Row $row: The row of data.

Return value

string The entity ID for the row that we are importing.

Overrides Entity::getEntityId

File

core/modules/block/src/Plugin/migrate/destination/EntityBlock.php, line 20

Class

EntityBlock
Plugin annotation @MigrateDestination( id = "entity:block" )

Namespace

Drupal\block\Plugin\migrate\destination

Code

protected function getEntityId(Row $row) {

  // Try to find the block by its plugin ID and theme.
  $properties = [
    'plugin' => $row
      ->getDestinationProperty('plugin'),
    'theme' => $row
      ->getDestinationProperty('theme'),
  ];
  $blocks = array_keys($this->storage
    ->loadByProperties($properties));
  return reset($blocks);
}