drupal_attributes(array $attributes = array())Format an attribute string to insert in a tag.
Each array key and its value will be formatted into an HTML attribute string. If a value is itself an array, then each array element is concatenated with a space between each value (e.g. a multi-value class attribute).
$attributes An associative array of HTML attributes.
An HTML string ready for insertion in a tag.
includes/common.inc, line 2119
<?php
function drupal_attributes(array $attributes = array()) {
foreach ($attributes as $attribute => &$data) {
if (is_array($data)) {
$data = implode(' ', $data);
}
$data = $attribute . '="' . check_plain($data) . '"';
}
return $attributes ? ' ' . implode(' ', $attributes) : '';
}
?>