function LayoutInfoController::layoutInfoPage

Same name in other branches
  1. 8.x-1.x src/Controller/LayoutInfoController.php \Drupal\devel\Controller\LayoutInfoController::layoutInfoPage()
  2. 4.x src/Controller/LayoutInfoController.php \Drupal\devel\Controller\LayoutInfoController::layoutInfoPage()

Builds the Layout Info page.

Return value

array Array of page elements to render.

1 string reference to 'LayoutInfoController::layoutInfoPage'
devel.routing.yml in ./devel.routing.yml
devel.routing.yml

File

src/Controller/LayoutInfoController.php, line 36

Class

LayoutInfoController
Returns response for Layout Info route.

Namespace

Drupal\devel\Controller

Code

public function layoutInfoPage() : array {
    $headers = [
        $this->t('Icon'),
        $this->t('Label'),
        $this->t('Description'),
        $this->t('Category'),
        $this->t('Regions'),
        $this->t('Provider'),
    ];
    $rows = [];
    foreach ($this->layoutPluginManager
        ->getDefinitions() as $layout) {
        $rows[] = [
            'icon' => [
                'data' => $layout->getIcon(),
            ],
            'label' => $layout->getLabel(),
            'description' => $layout->getDescription(),
            'category' => $layout->getCategory(),
            'regions' => implode(', ', $layout->getRegionLabels()),
            'provider' => $layout->getProvider(),
        ];
    }
    $output['layouts'] = [
        '#type' => 'table',
        '#header' => $headers,
        '#rows' => $rows,
        '#empty' => $this->t('No layouts available.'),
        '#attributes' => [
            'class' => [
                'devel-layout-list',
            ],
        ],
    ];
    return $output;
}