You are here

function drush_features_status in Features 8.3

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

Provides Drush command callback for features-status.

File

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

Code

function drush_features_status() {
  $args = func_get_args();
  $assigner = _drush_features_options();

  /** @var \Drupal\features\FeaturesManagerInterface $manager */
  $manager = \Drupal::service('features.manager');
  $current_bundle = $assigner
    ->getBundle();
  $export_settings = $manager
    ->getExportSettings();
  $methods = $assigner
    ->getEnabledAssigners();
  if ($current_bundle
    ->isDefault()) {
    drush_print(dt('Current bundle: none'));
  }
  else {
    drush_print(dt('Current bundle: @name (@machine_name)', [
      '@name' => $current_bundle
        ->getName(),
      '@machine_name' => $current_bundle
        ->getMachineName(),
    ]));
  }
  drush_print(dt('Export folder: @folder', [
    '@folder' => $export_settings['folder'],
  ]));
  $dt_args = [
    '@methods' => implode(', ', array_keys($methods)),
  ];
  drush_print(dt('The following assignment methods are enabled:'));
  drush_print(dt('  @methods', $dt_args));
  if (!empty($args)) {
    $config = $manager
      ->getConfigCollection();
    if (count($args) > 1) {
      print_r(array_keys($config));
    }
    else {
      print_r($config[$args[0]]);
    }
  }
}