You are here

public function UiPatternsManager::getDefinitions in UI Patterns 8

Return pattern definitions.

Return value

\Drupal\ui_patterns\Definition\PatternDefinition[] Pattern definitions.

Overrides DefaultPluginManager::getDefinitions

3 calls to UiPatternsManager::getDefinitions()
UiPatternsManager::getPatterns in src/UiPatternsManager.php
Get pattern objects.
UiPatternsManager::getPatternsOptions in src/UiPatternsManager.php
UiPatternsManager::isPatternHook in src/UiPatternsManager.php

File

src/UiPatternsManager.php, line 66

Class

UiPatternsManager
Provides the default ui_patterns manager.

Namespace

Drupal\ui_patterns

Code

public function getDefinitions() {
  $definitions = $this
    ->getCachedDefinitions();
  if (!isset($definitions)) {

    // Remove derivative id from pattern definitions keys.
    // @todo: make sure validation takes care of ensuring ids are unique.
    $definitions = [];
    foreach ($this
      ->findDefinitions() as $id => $definition) {
      $definitions[$definition['id']] = $definition;
      unset($definitions[$id]);
    }
    $this
      ->setCachedDefinitions($definitions);
  }
  return $definitions;
}