You are here

function _drush_features_options in Features 8.4

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

Applies global options for Features drush commands.

The option --name="bundle_name" sets the bundle namespace.

Return value

\Drupal\features\FeaturesAssignerInterface

7 calls to _drush_features_options()
drush_features_add in drush/features.drush8.inc
Adds a component to a features module.
drush_features_components in drush/features.drush8.inc
Lists components, with pattern matching.
drush_features_export in drush/features.drush8.inc
Provides Drush command callback for features-export.
drush_features_import in drush/features.drush8.inc
Imports module config into the active store.
drush_features_import_all in drush/features.drush8.inc
Drush command callback for features-import-all.

... See full list

File

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

Code

function _drush_features_options() {

  /** @var \Drupal\features\FeaturesAssignerInterface $assigner */
  $assigner = \Drupal::service('features_assigner');
  $bundle_name = drush_get_option('bundle');
  if (!empty($bundle_name)) {
    $bundle = $assigner
      ->applyBundle($bundle_name);
    if ($bundle
      ->getMachineName() != $bundle_name) {
      drush_log(dt('Bundle @name not found. Using default.', [
        '@name' => $bundle_name,
      ]), 'warning');
    }
  }
  else {
    $assigner
      ->assignConfigPackages();
  }
  return $assigner;
}