You are here

function migrate_views_default_views in Migrate 7.2

Implements hook_views_default_views().

File

migrate/migrate.views_default.inc, line 11
migrate.views_default.inc Contains default views.

Code

function migrate_views_default_views() {
  $migrations = migrate_migrations();
  $views = array();
  foreach ($migrations as $migration) {

    // We can only do things with migrations that use the SQLMap.
    $map = $migration
      ->getMap();
    $migration_name = $migration
      ->getMachineName();
    if (!is_a($map, 'MigrateSQLMap')) {
      continue;
    }

    // Skip non-entities.
    $destination = $migration
      ->getDestination();
    if (!is_a($destination, 'MigrateDestinationEntity')) {
      continue;
    }
    $view = migrate_views_default_views_get_view($migration);

    // Add view to list of views to provide.
    $views[$view->name] = $view;
  }
  return $views;
}