You are here

public function SiteAuditCheckContentContentTypes::getResultInfo in Site Audit 7

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

Overrides SiteAuditCheckAbstract::getResultInfo

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

File

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

Class

SiteAuditCheckContentContentTypes
Class SiteAuditCheckContentContentTypes.

Code

public function getResultInfo() {
  $ret_val = '';
  if (empty($this->registry['content_type_counts'])) {
    if (drush_get_option('detail')) {
      return dt('No nodes exist.');
    }
    return $ret_val;
  }
  $ret_val .= "Total: {$this->registry['node_count']} nodes";
  if (drush_get_option('html') == TRUE) {
    $ret_val = "<p>{$ret_val}</p>";
  }
  else {
    $ret_val .= PHP_EOL;
  }
  if (drush_get_option('html') == TRUE) {
    $ret_val .= '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>' . dt('Content Type') . '</th><th>' . dt('Node Count') . '</th></tr></thead>';
    foreach ($this->registry['content_type_counts'] as $content_type => $count) {
      $ret_val .= "<tr><td>{$content_type}</td><td>{$count}</td></tr>";
    }
    $ret_val .= '</table>';
  }
  else {
    if (!drush_get_option('json')) {
      $ret_val .= str_repeat(' ', 4);
    }
    $ret_val .= '-------------------';
    foreach ($this->registry['content_type_counts'] as $content_type => $count) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= $content_type . ': ' . $count;
    }
  }
  return $ret_val;
}