You are here

public function ConfigActionsCommands::actionsList in Config Actions 8

Display a list of available actions in modules.

@command config:actions-list @aliases cal,config-actions-list

Parameters

$module_name: Optional name of module to filter the list.

$file: Optional name of file within module to list.

File

src/Commands/ConfigActionsCommands.php, line 50

Class

ConfigActionsCommands
A Drush commandfile.

Namespace

Drupal\config_actions\Commands

Code

public function actionsList($module_name = '', $file = '') {
  $list = $this->configActions
    ->listAll($module_name, $file);
  if (empty($list)) {
    $this
      ->output()
      ->writeln(dt('No actions found.'));
  }
  else {
    foreach ($list as $module => $files) {
      $this
        ->output()
        ->writeln(dt('Module: @name', array(
        '@name' => $module,
      )));
      foreach ($files as $filename => $actions) {
        $this
          ->output()
          ->writeln(dt('  File: @file', array(
          '@file' => $filename,
        )));
        foreach ($actions as $action_id => $action) {
          if (!empty($action_id)) {
            $this
              ->output()
              ->writeln(dt('    @action', array(
              '@action' => $action_id,
            )));
          }
        }
      }
    }
  }
}