drupal_attributes

Definition

drupal_attributes($attributes = array())
includes/common.inc, line 1232

Description

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

Namesort iconDescription
Input validationFunctions to validate user input.

Code

<?php
function drupal_attributes($attributes = array()) {
  if (is_array($attributes)) {
    $t = '';
    foreach ($attributes as $key => $value) {
      $t .= " $key=".'"'. check_plain($value) .'"';
    }
    return $t;
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.