| 5 common.inc | drupal_attributes($attributes = array()) |
| 6 common.inc | drupal_attributes($attributes = array()) |
| 7 common.inc | drupal_attributes(array $attributes = array()) |
| 8 common.inc | drupal_attributes(array $attributes = array()) |
Format an attribute string to insert in a tag.
Parameters
$attributes: An associative array of HTML attributes.
Return value
An HTML string ready for insertion in a tag.
Related topics
File
- includes/
common.inc, line 1374 - Common functions that many Drupal modules will need to reference.
Code
<?php
function drupal_attributes($attributes = array()) {
if (is_array($attributes)) {
$t = '';
foreach ($attributes as $key => $value) {
$t .= " $key=" . '"' . check_plain($value) . '"';
}
return $t;
}
}
?>Login or register to post comments