function EntityBlock::getEntityId

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

Overrides Entity::getEntityId

File

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

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);
}

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