You are here

protected function DrupalmoduleupgraderCommands::dmuPluginList in Drupal 7 to 8/9 Module Upgrader 8

Returns a list of plugin IDs of a given type.

Returns a list of plugin IDs of a given type filtered by the `--only` and `--skip` options.

Parameters

string $plugin_type: Plugin type.

array $options: Options array.

Return value

array Array of plugin lists.

3 calls to DrupalmoduleupgraderCommands::dmuPluginList()
DrupalmoduleupgraderCommands::analyze in src/Commands/DrupalmoduleupgraderCommands.php
Analyzes a Drupal 7 module and reports the changes needed to port it to Drupal 8 or Drupal 9.
DrupalmoduleupgraderCommands::dmuList in src/Commands/DrupalmoduleupgraderCommands.php
Lists available plugins.
DrupalmoduleupgraderCommands::upgrade in src/Commands/DrupalmoduleupgraderCommands.php
Upgrades a Drupal 7 module to Drupal 8 or Drupal 9.

File

src/Commands/DrupalmoduleupgraderCommands.php, line 269

Class

DrupalmoduleupgraderCommands

Namespace

Drupal\drupalmoduleupgrader\Commands

Code

protected function dmuPluginList(string $plugin_type, array $options) {

  // Instantiate the plugin manager and get all available plugin IDs.
  $manager = \Drupal::service('plugin.manager.drupalmoduleupgrader.' . $plugin_type);
  $plugin_IDs = array_keys($manager
    ->getDefinitions());
  if ($options['only']) {
    $plugin_IDs = array_intersect($plugin_IDs, explode(',', $options['only']));
  }
  elseif ($options['skip']) {
    $plugin_IDs = array_diff($plugin_IDs, explode(',', $options['skip']));
  }
  return $plugin_IDs;
}