You are here

function drush_config_actions_list in Config Actions 8

Drush command callback for config-actions-list.

File

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

Code

function drush_config_actions_list() {

  /** @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);
  $list = $config_actions
    ->listAll($module_name, $file);
  if (empty($list)) {
    Drush::output()
      ->writeln('No actions found.');
  }
  else {
    foreach ($list as $module => $files) {
      Drush::output()
        ->writeln(dt('Module: @name', array(
        '@name' => $module,
      )));
      foreach ($files as $filename => $actions) {
        Drush::output()
          ->writeln(dt('  File: @file', array(
          '@file' => $filename,
        )));
        foreach ($actions as $action_id => $action) {
          if (!empty($action_id)) {
            Drush::output()
              ->writeln(dt('    @action', array(
              '@action' => $action_id,
            )));
          }
        }
      }
    }
  }
}