You are here

function drush_gathercontent_list_status in GatherContent 7.3

Same name and namespace in other branches
  1. 8.5 gathercontent.drush.inc \drush_gathercontent_list_status()
  2. 8.3 gathercontent.drush.inc \drush_gathercontent_list_status()
  3. 8.4 gathercontent.drush.inc \drush_gathercontent_list_status()

Implements drush_COMMAND().

File

./gathercontent.drush.inc, line 120
Drush command to cli config import.

Code

function drush_gathercontent_list_status($project_id = NULL) {
  $project_obj = new Project();
  if ($project_id === NULL) {
    $projects = $project_obj
      ->getProjects();
    $options = [];
    foreach ($projects as $id => $label) {
      $options[$id] = $id . ' | ' . $label;
    }
    $project_id = drush_choice($options, dt('Select a project ID: '));
  }
  if (!$project_id) {
    return drush_set_error('gathercontent_unknown_mapping_id', dt('Unknown mapping ID.'));
  }
  $statuses = $project_obj
    ->getStatuses($project_id);
  $mappings = [];
  foreach ($statuses as $status) {
    $mappings[$status->id] = [
      'status_id' => $status->id,
      'status_label' => $status->name,
    ];
  }
  return $mappings;
}