You are here

protected function FeaturesCommands::componentMap in Features 8.3

Same name and namespace in other branches
  1. 8.4 src/Commands/FeaturesCommands.php \Drupal\features\Commands\FeaturesCommands::componentMap()

Provides a component to feature map (port of features_get_component_map).

1 call to FeaturesCommands::componentMap()
FeaturesCommands::componentFilter in src/Commands/FeaturesCommands.php
Filters components by patterns.

File

src/Commands/FeaturesCommands.php, line 1012

Class

FeaturesCommands
Drush commands for Features.

Namespace

Drupal\features\Commands

Code

protected function componentMap() {
  $result = [];
  $manager = $this->manager;

  // Recalc full config list without running assignments.
  $config = $manager
    ->getConfigCollection();
  $packages = $manager
    ->getPackages();
  foreach ($config as $item) {
    $type = $item
      ->getType();
    $short_name = $item
      ->getShortName();
    if (!isset($result[$type][$short_name])) {
      $result[$type][$short_name] = [];
    }
    if (!empty($item
      ->getPackage())) {
      $package = $packages[$item
        ->getPackage()];
      $result[$type][$short_name][] = $package
        ->getMachineName();
    }
  }
  return $result;
}