You are here

function drush_onlyone_list in Allow a content type only once (Only One) 8

Same name and namespace in other branches
  1. 7 onlyone.drush.inc \drush_onlyone_list()

Callback for the onlyone-list command.

File

./onlyone.drush.inc, line 93
Drush commands related to the Only One module.

Code

function drush_onlyone_list($status = '') {

  // Check for correct argument.
  $options = [
    'configured' => dt("Content types configured in 'Only One content' mode."),
    'available' => dt("Content types that can be configured in 'Only One content' mode."),
    'notavailable' => dt("Content types that can't be configured in 'Only One content' mode."),
    'summary' => dt("The summary for all the content types."),
  ];
  if (!in_array($status, array_keys($options))) {
    if (!empty($status)) {
      drush_log(dt('"@status" is not a valid status argument.', [
        '@status' => $status,
      ]), 'warning');
    }
    $status = drush_choice($options, dt('What kind of list would you like to print?'));
  }
  if (!empty($status)) {
    $function_name = '_drush_onlyone_' . $status;
    $function_name();
  }
}