You are here

public function StatusReportController::build in Production check & Production monitor 8

Builds a list of fields

1 string reference to 'StatusReportController::build'
prod_check.routing.yml in ./prod_check.routing.yml
prod_check.routing.yml

File

src/Controller/StatusReportController.php, line 57

Class

StatusReportController
Route controller fields.

Namespace

Drupal\prod_check\Controller

Code

public function build() {

  /** @var ProdCheckProcessor $internal_processor */
  $internal_processor = ProdCheckProcessor::load('internal');
  $requirements = $internal_processor
    ->getPlugin()
    ->requirements();

  // Get all categories.
  $categories = $this->categoryManager
    ->getDefinitions();

  // Array where we keep track of the requirements per category.
  $requirements_per_category = [];

  // Prefill the requirements per category so we have the same order as the
  // categories themselves.
  foreach ($categories as $key => $category) {
    $requirements_per_category[$key] = [];
  }
  foreach ($requirements as $key => $requirement) {
    $requirements_per_category[$requirement['category']][$key] = $requirement;
  }
  return [
    '#theme' => 'prod_check_status_report',
    '#requirements' => $requirements_per_category,
    '#categories' => $categories,
  ];
}