You are here

EntityBlock.php in Drupal 9

Same filename and directory in other branches
  1. 8 core/modules/block/src/Plugin/migrate/destination/EntityBlock.php

File

core/modules/block/src/Plugin/migrate/destination/EntityBlock.php
View source
<?php

namespace Drupal\block\Plugin\migrate\destination;

use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
use Drupal\migrate\Row;

/**
 * @MigrateDestination(
 *   id = "entity:block"
 * )
 */
class EntityBlock extends EntityConfigBase {

  /**
   * {@inheritdoc}
   */
  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);
  }

}

Classes

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