public static function HtmlResponseAttachmentsProcessor::formatHttpHeaderAttributes in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::formatHttpHeaderAttributes()
- 9 core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php \Drupal\Core\Render\HtmlResponseAttachmentsProcessor::formatHttpHeaderAttributes()
Formats an attribute string for an HTTP header.
@internal
Parameters
array $attributes: An associative array of attributes such as 'rel'.
Return value
string 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
https://www.drupal.org/node/3000051
File
- core/
lib/ Drupal/ Core/ Render/ HtmlResponseAttachmentsProcessor.php, line 232
Class
- HtmlResponseAttachmentsProcessor
- Processes attachments of HTML responses.
Namespace
Drupal\Core\RenderCode
public static function formatHttpHeaderAttributes(array $attributes = []) {
foreach ($attributes as $attribute => &$data) {
if (is_array($data)) {
$data = implode(' ', $data);
}
$data = $attribute . '="' . $data . '"';
}
return $attributes ? ' ' . implode('; ', $attributes) : '';
}