You are here

function drush_config_actions_run in Config Actions 8

Drush command callback for config-actions-run.

File

./config_actions.drush.inc, line 72
Config Actions drush integration.

Code

function drush_config_actions_run() {

  /** @var \Drupal\config_actions\ConfigActionsServiceInterface $config_actions */
  $config_actions = \Drupal::service('config_actions');
  $args = func_get_args();
  $module_name = array_shift($args);
  $file = array_shift($args);
  $action_id = array_shift($args);
  $result = $config_actions
    ->importAction($module_name, $action_id, $file);
  if (empty($result)) {
    Drush::output()
      ->writeln('No actions were executed.');
  }
  else {
    foreach ($result as $source => $config) {
      if (is_null($config)) {
        Drush::output()
          ->writeln(dt('  Action: @action - SKIPPED', array(
          '@action' => $source,
        )));
      }
      else {
        Drush::output()
          ->writeln(dt('  Action: @action', array(
          '@action' => $source,
        )));
      }
    }
  }
}