You are here

function _dmu_plugin_list in Drupal 7 to 8/9 Module Upgrader 8

Returns a list of plugin IDs of a given type.

Filtered by the --only and --skip options.

Parameters

string $plugin_type: The plugin type. Can be one of indexer, analyzer, converter, cleaner.

Return value

array Plugin ID's.

2 calls to _dmu_plugin_list()
drush_drupalmoduleupgrader_dmu_analyze in ./drupalmoduleupgrader.drush.inc
Analyzes what needs changing in a module to port it to Drupal 8.
drush_drupalmoduleupgrader_dmu_upgrade in ./drupalmoduleupgrader.drush.inc
Tries to automatically convert a Drupal 7 module to Drupal 8.

File

./drupalmoduleupgrader.drush.inc, line 112
Declarations for Drush.

Code

function _dmu_plugin_list($plugin_type) {

  // Instantiate the plugin manager and get all available plugin IDs.
  $manager = \Drupal::service('plugin.manager.drupalmoduleupgrader.' . $plugin_type);
  $plugin_ids = array_keys($manager
    ->getDefinitions());

  // Filter by the --only and --skip options, if set.
  if ($only = drush_get_option('only', FALSE)) {
    $plugin_ids = array_intersect($plugin_ids, explode(',', $only));
  }
  elseif ($skip = drush_get_option('skip', FALSE)) {
    $plugin_ids = array_diff($plugin_ids, explode(',', $skip));
  }
  return $plugin_ids;
}