You are here

public function MigrationPluginManager::createInstancesByTag in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::createInstancesByTag()

Create migrations given a tag.

Parameters

string $tag: A migration tag we want to filter by.

Return value

array|\Drupal\migrate\Plugin\MigrationInterface[] An array of migration objects with the given tag.

Overrides MigrationPluginManagerInterface::createInstancesByTag

File

core/modules/migrate/src/Plugin/MigrationPluginManager.php, line 132

Class

MigrationPluginManager
Plugin manager for migration plugins.

Namespace

Drupal\migrate\Plugin

Code

public function createInstancesByTag($tag) {
  $migrations = array_filter($this
    ->getDefinitions(), function ($migration) use ($tag) {
    return !empty($migration['migration_tags']) && in_array($tag, $migration['migration_tags']);
  });
  return $this
    ->createInstances(array_keys($migrations));
}