You are here

public function MigrateTemplateStorage::findTemplatesByTag in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/MigrateTemplateStorage.php \Drupal\migrate\MigrateTemplateStorage::findTemplatesByTag()

Find all migration templates with the specified tag.

Parameters

$tag: The tag to match.

Return value

array Any templates (parsed YAML config) that matched, keyed by the ID.

File

core/modules/migrate/src/MigrateTemplateStorage.php, line 52
Contains \Drupal\migrate\MigrateTemplateStorage.

Class

MigrateTemplateStorage
Storage to access migration template configuration in enabled extensions.

Namespace

Drupal\migrate

Code

public function findTemplatesByTag($tag) {
  $templates = $this
    ->getAllTemplates();
  $matched_templates = [];
  foreach ($templates as $template_name => $template) {
    if (!empty($template['migration_tags'])) {
      if (in_array($tag, $template['migration_tags'])) {
        $matched_templates[$template_name] = $template;
      }
    }
  }
  return $matched_templates;
}