You are here

function drupal_http_header_attributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/common.inc \drupal_http_header_attributes()

Formats an attribute string for an HTTP header.

Parameters

$attributes: An associative array of attributes such as 'rel'.

Return value

A ; separated string ready for insertion in a HTTP header. No escaping is performed for HTML entities, so this string is not safe to be printed.

1 call to drupal_http_header_attributes()
HtmlResponseAttachmentsProcessor::processHtmlHeadLink in core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php
Transform a html_head_link array into html_head and http_header arrays.

File

core/includes/common.inc, line 356
Common functions that many Drupal modules will need to reference.

Code

function drupal_http_header_attributes(array $attributes = array()) {
  foreach ($attributes as $attribute => &$data) {
    if (is_array($data)) {
      $data = implode(' ', $data);
    }
    $data = $attribute . '="' . $data . '"';
  }
  return $attributes ? ' ' . implode('; ', $attributes) : '';
}