You are here

function _drush_features_get_component_map in Features 8.4

Same name and namespace in other branches
  1. 8.3 drush/features.drush8.inc \_drush_features_get_component_map()

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

1 call to _drush_features_get_component_map()
_drush_features_component_filter in drush/features.drush8.inc
Filters components by patterns.

File

drush/features.drush8.inc, line 867
Features module drush integration.

Code

function _drush_features_get_component_map() {
  $result = [];

  /** @var \Drupal\features\FeaturesManagerInterface $manager */
  $manager = \Drupal::service('features.manager');

  // Recalc full config list without running assignments.
  $config = $manager
    ->getConfigCollection();
  $packages = $manager
    ->getPackages();
  foreach ($config as $item_name => $item) {
    $type = $item
      ->getType();
    $short_name = $item
      ->getShortName();
    $name = $item
      ->getName();
    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;
}