You are here

public function ContentFieldInstances::getResultInfo in Site Audit 8.3

.

Overrides SiteAuditCheckBase::getResultInfo

File

src/Plugin/SiteAuditCheck/ContentFieldInstances.php, line 27

Class

ContentFieldInstances
Provides the ContentFieldInstances Check.

Namespace

Drupal\site_audit\Plugin\SiteAuditCheck

Code

public function getResultInfo() {
  $table_rows = [];
  foreach ($this->registry->field_instance_counts as $bundle_name => $entity_types) {
    foreach ($entity_types as $entity_type => $fields) {
      foreach ($fields as $field_name => $count) {
        $table_rows[] = [
          $entity_type,
          $field_name,
          $bundle_name,
          $count,
        ];
      }
    }
  }
  $header = [
    $this
      ->t('Entity Type'),
    $this
      ->t('Field Name'),
    $this
      ->t('Bundle Name'),
    $this
      ->t('Count'),
  ];
  return [
    '#theme' => 'table',
    '#class' => 'table-condensed',
    '#header' => $header,
    '#rows' => $table_rows,
  ];
}