You are here

public function SiteAuditCheckContentVocabularies::getResultInfo in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Content/Vocabularies.php \SiteAuditCheckContentVocabularies::getResultInfo()

Implements \SiteAudit\Check\Abstract\getResultInfo().

Overrides SiteAuditCheckAbstract::getResultInfo

1 call to SiteAuditCheckContentVocabularies::getResultInfo()
SiteAuditCheckContentVocabularies::getResultWarn in Check/Content/Vocabularies.php
Implements \SiteAudit\Check\Abstract\getResultWarn().

File

Check/Content/Vocabularies.php, line 34
Contains \SiteAudit\Check\Content\Vocabularies.

Class

SiteAuditCheckContentVocabularies
Class SiteAuditCheckContentVocabularies.

Code

public function getResultInfo() {
  if (!isset($this->registry['vocabulary_counts'])) {
    return dt('The taxonomy module is not enabled.');
  }
  if (empty($this->registry['vocabulary_counts'])) {
    if (drush_get_option('detail')) {
      return dt('No vocabularies exist.');
    }
    return '';
  }
  $ret_val = '';
  if (drush_get_option('html') == TRUE) {
    $ret_val .= '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>' . dt('Vocabulary') . '</th><th>' . dt('Terms') . '</th></tr></thead>';
    foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
      $ret_val .= "<tr><td>{$vocabulary}</td><td>{$count}</td></tr>";
    }
    $ret_val .= '</table>';
  }
  else {
    $ret_val = dt('Vocabulary: Count') . PHP_EOL;
    if (!drush_get_option('json')) {
      $ret_val .= str_repeat(' ', 4);
    }
    $ret_val .= '-------------------';
    foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= $vocabulary . ': ' . $count;
    }
  }
  return $ret_val;
}