class LayoutBuilderThemeSuggestionsTestThemeHooks

Theme hook implementations for layout_builder_theme_suggestions_test.

Hierarchy

Expanded class hierarchy of LayoutBuilderThemeSuggestionsTestThemeHooks

File

core/modules/layout_builder/tests/modules/layout_builder_theme_suggestions_test/src/Hook/LayoutBuilderThemeSuggestionsTestThemeHooks.php, line 12

Namespace

Drupal\layout_builder_theme_suggestions_test\Hook
View source
class LayoutBuilderThemeSuggestionsTestThemeHooks {
  
  /**
   * Implements hook_theme().
   */
  public function theme() : array {
    // It is necessary to explicitly register the template via hook_theme()
    // because it is added via a module, not a theme.
    return [
      'field__node__body__bundle_with_section_field__default' => [
        'base hook' => 'field',
      ],
    ];
  }
  
  /**
   * Implements hook_preprocess_HOOK() for the list of layouts.
   */
  public function itemListLayouts(&$variables) : void {
    foreach (array_keys($variables['items']) as $layout_id) {
      if (isset($variables['items'][$layout_id]['value']['#title']['icon'])) {
        $variables['items'][$layout_id]['value']['#title']['icon'] = [
          '#markup' => __METHOD__,
        ];
      }
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary
LayoutBuilderThemeSuggestionsTestThemeHooks::itemListLayouts public function Implements hook_preprocess_HOOK() for the list of layouts.
LayoutBuilderThemeSuggestionsTestThemeHooks::theme public function Implements hook_theme().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.