function drupal_http_header_attributes

Same name in other branches
  1. 8.9.x 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.

See also

drupal_add_http_header()

1 call to drupal_http_header_attributes()
drupal_add_html_head_link in includes/common.inc
Adds a LINK tag with distinct attributes to the page's HEAD.

File

includes/common.inc, line 2468

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) : '';
}

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