| Versions | |
|---|---|
| 4.7 – 6 | drupal_attributes($attributes = array()) |
| 7 | drupal_attributes(array $attributes = array()) |
Format an attribute string to insert in a tag.
$attributes An associative array of HTML attributes.
An HTML string ready for insertion in a tag.
includes/
<?php
function drupal_attributes($attributes = array()) {
if (is_array($attributes)) {
$t = '';
foreach ($attributes as $key => $value) {
$t .= " $key=" . '"' . check_plain($value) . '"';
}
return $t;
}
}
?>