You are here

public function PatternsLibraryController::overview in UI Patterns 8

Render pattern library page.

Return value

array Patterns overview page render array.

1 string reference to 'PatternsLibraryController::overview'
ui_patterns_library.routing.yml in modules/ui_patterns_library/ui_patterns_library.routing.yml
modules/ui_patterns_library/ui_patterns_library.routing.yml

File

modules/ui_patterns_library/src/Controller/PatternsLibraryController.php, line 79

Class

PatternsLibraryController
Class PatternLibraryController.

Namespace

Drupal\ui_patterns_library\Controller

Code

public function overview() {
  $patterns = [];
  foreach ($this->patternsManager
    ->getDefinitions() as $definition) {
    $patterns[$definition
      ->id()] = $definition
      ->toArray() + [
      'meta' => [
        '#theme' => 'patterns_meta_information',
        '#pattern' => $definition
          ->toArray(),
      ],
      'rendered' => $this
        ->getPatternRenderArray($definition),
      'definition' => $definition
        ->toArray(),
    ];
  }
  return [
    '#theme' => 'patterns_overview_page',
    '#patterns' => $patterns,
  ];
}