function layout_builder_test_preprocess_layout__onecol

Same name and namespace in other branches
  1. 10 core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module \layout_builder_test_preprocess_layout__onecol()
  2. 11.x core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module \layout_builder_test_preprocess_layout__onecol()

Implements hook_preprocess_HOOK() for one-column layout template.

File

core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module, line 138

Code

function layout_builder_test_preprocess_layout__onecol(&$vars) {
    if (!empty($vars['content']['#entity'])) {
        $vars['content']['content'][\Drupal::service('uuid')->generate()] = [
            '#type' => 'markup',
            '#markup' => sprintf('Yes, I can access the %s', $vars['content']['#entity']->label()),
        ];
    }
}

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