You are here

public function EntityUpdateStatus::entityStatus in Entity Update 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/EntityUpdateStatus.php \Drupal\entity_update\Controller\EntityUpdateStatus::entityStatus()

Get entity types status.

1 string reference to 'EntityUpdateStatus::entityStatus'
entity_update.routing.yml in ./entity_update.routing.yml
entity_update.routing.yml

File

src/Controller/EntityUpdateStatus.php, line 31

Class

EntityUpdateStatus
Entity Update status displays.

Namespace

Drupal\entity_update\Controller

Code

public function entityStatus() {
  $output = [];
  $output['#cache']['max-age'] = 0;
  $list = EntityUpdate::getEntityTypesToUpdate();
  if (empty($list)) {
    $output[] = [
      '#type' => 'markup',
      '#markup' => "All Entities are up to date.",
      '#prefix' => '<div><b><i>',
      '#suffix' => '</i></b></div>',
    ];
  }
  else {
    foreach ($list as $item => $entity_type_changes) {
      $count = count($entity_type_changes);
      $table = [
        '#theme' => 'table',
        '#cache' => [
          'max-age' => 0,
        ],
        '#caption' => "Change of the entity '{$item}' ({$count})",
        '#header' => [
          'Type ID',
          'Type',
          'Name',
        ],
        '#rows' => [],
      ];
      foreach ($entity_type_changes as $ec_key => $entity_change_summ) {
        $table['#rows'][] = [
          $ec_key,
          $entity_change_summ,
        ];
      }
      $output['tables'][] = $table;
    }
  }
  return $output;
}