You are here

function _drush_onlyone_configured in Allow a content type only once (Only One) 7

Same name and namespace in other branches
  1. 8 onlyone.drush.inc \_drush_onlyone_configured()

List the content types configured in 'Only One content' mode.

File

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

Code

function _drush_onlyone_configured() {

  // Getting the configured content types to have only one content.
  $onlyone_content_types = variable_get('onlyone_node_types');
  if (count($onlyone_content_types)) {

    // Searching the content type name.
    $content_types = array();
    foreach ($onlyone_content_types as $content_type) {
      $content_type_object = node_type_get_type($content_type);
      $content_types[$content_type] = $content_type_object->name . ' [' . $content_type_object->type . ']';
    }
    drush_print(dt("Content types configured in 'Only One content' mode:"));
    drush_print(' ' . implode("\n ", $content_types));
  }
  else {
    drush_print(dt("There is no content type configured in 'Only One content' mode."));
  }
}