5 * Provides hook implementations for Layout Discovery.
9 * Implements hook_help().
11 function layout_discovery_help($route_name) {
12 switch ($route_name) {
13 case 'help.page.layout_discovery':
14 $output = '<h3>' . t('About') . '</h3>';
15 $output .= '<p>' . t('Layout Discovery allows modules or themes to register layouts, and for other modules to list the available layouts and render them.') . '</p>';
16 $output .= '<p>' . t('For more information, see the <a href=":layout-discovery-documentation">online documentation for the Layout Discovery module</a>.', [':layout-discovery-documentation' => 'https://www.drupal.org/node/2619128']) . '</p>';
22 * Implements hook_theme().
24 function layout_discovery_theme() {
25 return \Drupal::service('plugin.manager.core.layout')->getThemeImplementations();
29 * Prepares variables for layout templates.
31 * @param array &$variables
32 * An associative array containing:
33 * - content: An associative array containing the properties of the element.
34 * Properties used: #settings, #layout.
36 function template_preprocess_layout(&$variables) {
37 $variables['settings'] = isset($variables['content']['#settings']) ? $variables['content']['#settings'] : [];
38 $variables['layout'] = isset($variables['content']['#layout']) ? $variables['content']['#layout'] : [];