function HtmlResponseAttachmentsProcessor::processHtmlHead

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processHtmlHead()
  2. 10 core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processHtmlHead()
  3. 11.x core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::processHtmlHead()

Ensure proper key/data order and defaults for renderable head items.

Parameters

array $html_head: The ['#attached']['html_head'] portion of a render array.

Return value

array The ['#attached']['html_head'] portion of a render array with #type of html_tag added for items without a #type.

1 call to HtmlResponseAttachmentsProcessor::processHtmlHead()
HtmlResponseAttachmentsProcessor::processAttachments in core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php
Processes the attachments of a response that has attachments.

File

core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php, line 396

Class

HtmlResponseAttachmentsProcessor
Processes attachments of HTML responses.

Namespace

Drupal\Core\Render

Code

protected function processHtmlHead(array $html_head) {
    $head = [];
    foreach ($html_head as $item) {
        list($data, $key) = $item;
        if (!isset($data['#type'])) {
            $data['#type'] = 'html_tag';
        }
        $head[$key] = $data;
    }
    return $head;
}

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