You are here

public function RenderAttachedTestController::head in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/render_attached_test/src/Controller/RenderAttachedTestController.php \Drupal\render_attached_test\Controller\RenderAttachedTestController::head()

Test attached HTML head rendering.

Return value

array A render array using the 'html_head' directive.

1 string reference to 'RenderAttachedTestController::head'
render_attached_test.routing.yml in core/modules/system/tests/modules/render_attached_test/render_attached_test.routing.yml
core/modules/system/tests/modules/render_attached_test/render_attached_test.routing.yml

File

core/modules/system/tests/modules/render_attached_test/src/Controller/RenderAttachedTestController.php, line 49
Contains \Drupal\render_attached_test\Controller\RenderAttachedTestController.

Class

RenderAttachedTestController
Controller for various permutations of #attached in the render array.

Namespace

Drupal\render_attached_test\Controller

Code

public function head() {
  $head = [
    [
      '#tag' => 'meta',
      '#attributes' => [
        'test-attribute' => 'testvalue',
      ],
    ],
    'test_head_attribute',
  ];
  $render = [];
  $render['#attached']['html_head'][] = $head;
  return $render;
}