You are here

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

Implements drush_hook_COMMAND_validate().

File

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

Code

function drush_onlyone_new_menu_entry_validate() {
  $args = func_get_args();
  if (count($args) > 1) {
    return drush_set_error('ONLYONE_INVALID_ARGUMENT', dt('This command use only one argument.'));
  }

  // Available options.
  $available_options = [
    'on',
    'off',
  ];

  // Check for correct argument.
  if (isset($args[0]) && !in_array($args[0], $available_options)) {
    return drush_set_error('ONLYONE_INVALID_ARGUMENT', dt("You must specify as argument 'on' or 'off'"));
  }
}