You are here

public function LayoutPluginManager::getThemeImplementations in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Layout/LayoutPluginManager.php \Drupal\Core\Layout\LayoutPluginManager::getThemeImplementations()

Gets theme implementations for layouts.

Return value

array An associative array of the same format as returned by hook_theme().

Overrides LayoutPluginManagerInterface::getThemeImplementations

See also

hook_theme()

File

core/lib/Drupal/Core/Layout/LayoutPluginManager.php, line 162

Class

LayoutPluginManager
Provides a plugin manager for layouts.

Namespace

Drupal\Core\Layout

Code

public function getThemeImplementations() {
  $hooks = [];
  $hooks['layout'] = [
    'render element' => 'content',
  ];

  /** @var \Drupal\Core\Layout\LayoutDefinition[] $definitions */
  $definitions = $this
    ->getDefinitions();
  foreach ($definitions as $definition) {
    if ($template = $definition
      ->getTemplate()) {
      $hooks[$definition
        ->getThemeHook()] = [
        'render element' => 'content',
        'base hook' => 'layout',
        'template' => $template,
        'path' => $definition
          ->getTemplatePath(),
      ];
    }
  }
  return $hooks;
}