You are here

public function SiteAuditCheckContentContentEntityTypes::getResultInfo in Site Audit 8.2

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

Overrides SiteAuditCheckAbstract::getResultInfo

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

File

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

Class

SiteAuditCheckContentContentEntityTypes
Class SiteAuditCheckContentContentEntityTypes.

Code

public function getResultInfo() {
  $ret_val = '';
  if (empty($this->registry['content_entity_type_counts'])) {
    if (drush_get_option('detail')) {
      return dt('No entities exist.');
    }
    return $ret_val;
  }
  if (drush_get_option('html') == TRUE) {
    $ret_val .= '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>' . dt('Content Entity') . '</th><th>' . dt('Bundle') . '</th><th>' . dt('Count') . '</th></tr></thead>';
    foreach ($this->registry['content_entity_type_counts'] as $entity_type => $bundles) {
      foreach ($bundles as $bundle => $count) {
        $ret_val .= "<tr><td>{$entity_type}</td><td>{$bundle}</td><td>{$count}</td></tr>";
      }
    }
    $ret_val .= '</table>';
  }
  else {
    $rows = 0;
    foreach ($this->registry['content_entity_type_counts'] as $entity_type => $bundles) {
      if ($rows++ > 0) {
        $ret_val .= PHP_EOL;
        if (!drush_get_option('json')) {
          $ret_val .= str_repeat(' ', 4);
        }
      }
      $ret_val .= dt('Entity: @entity_type, total: @total', array(
        '@entity_type' => $entity_type,
        '@total' => $this->registry['entity_count'][$entity_type],
      ));
      foreach ($bundles as $bundle => $count) {
        $ret_val .= PHP_EOL;
        if (!drush_get_option('json')) {
          $ret_val .= str_repeat(' ', 6);
        }
        $ret_val .= "{$bundle}: {$count}";
      }
    }
  }
  return $ret_val;
}