You are here

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

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

List the summary for all the content types.

File

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

Code

function _drush_onlyone_summary() {
  $available_content_types = Drupal::service('onlyone')
    ->setFormatter(new OnlyOnePrintDrush())
    ->getAvailableContentTypesForPrint();
  $not_available_content_types = Drupal::service('onlyone')
    ->setFormatter(new OnlyOnePrintDrush())
    ->getNotAvailableContentTypesForPrint();
  $content_types_summary = array_merge($available_content_types, $not_available_content_types);

  // Sorting all the elements.
  asort($content_types_summary);
  if (count($content_types_summary)) {
    drush_print(dt('Status summary:'));
    drush_print(' ' . implode("\n ", $content_types_summary));
  }
  else {
    drush_log(dt('There are no content types on the site.'), 'warning');
  }
}