You are here

public function SiteAuditCheckContentFieldCount::getResultInfo in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Check/Content/FieldCount.php \SiteAuditCheckContentFieldCount::getResultInfo()

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

Overrides SiteAuditCheckAbstract::getResultInfo

File

Check/Content/FieldCount.php, line 36
Contains \SiteAudit\Check\Content\FieldCount.

Class

SiteAuditCheckContentFieldCount
Class SiteAuditCheckContentFieldCount.

Code

public function getResultInfo() {
  $ret_val = dt('There are @count total fields.', array(
    '@count' => count($this->registry['fields']),
  ));
  if (drush_get_option('detail')) {
    if (drush_get_option('html')) {
      $ret_val = '<p>' . $ret_val . '</p>';
      $ret_val .= '<table class="table table-condensed">';
      $ret_val .= '<tr><th>' . dt('Name') . '</th><th>' . dt('Type') . '</th></tr>';
      foreach ($this->registry['fields'] as $field_name => $description) {
        $ret_val .= "<tr><td>{$field_name}</td><td>{$description}</td></tr>";
      }
      $ret_val .= '</table>';
    }
    else {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= dt('Name: Type') . PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 4);
      }
      $ret_val .= '----------';
      foreach ($this->registry['fields'] as $field_name => $description) {
        $ret_val .= PHP_EOL;
        if (!drush_get_option('json')) {
          $ret_val .= str_repeat(' ', 4);
        }
        $ret_val .= "{$field_name}: {$description}";
      }
    }
  }
  return $ret_val;
}