drupal_attributes

includes/common.inc, line 1491

Versions
4.6 – 7
drupal_attributes($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.

▾ 23 functions call drupal_attributes()

drupal_add_link in includes/common.inc
Add a <link> tag to the page's HEAD.
format_xml_elements in includes/common.inc
Format XML elements.
l in includes/common.inc
Format an internal Drupal link.
node_feed in modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
template_preprocess_user_profile_category in modules/user/user.pages.inc
Process variables for user-profile-category.tpl.php.
template_preprocess_user_profile_item in modules/user/user.pages.inc
Process variables for user-profile-item.tpl.php.
theme_button in includes/form.inc
Theme a form button.
theme_checkbox in includes/form.inc
Format a checkbox.
theme_fieldset in includes/form.inc
Format a group of form items.
theme_file in includes/form.inc
Format a file upload field.
theme_form in includes/form.inc
Format a form.
theme_hidden in includes/form.inc
Format a hidden form field.
theme_image in includes/theme.inc
Return a themed image.
theme_image_button in includes/form.inc
Theme a form image button.
theme_item_list in includes/theme.inc
Return a themed list of items.
theme_links in includes/theme.inc
Return a themed set of links.
theme_password in includes/form.inc
Format a password field.
theme_radio in includes/form.inc
Format a radio button.
theme_select in includes/form.inc
Format a dropdown menu or scrolling selection box.
theme_table in includes/theme.inc
Return a themed table.
theme_textarea in includes/form.inc
Format a textarea.
theme_textfield in includes/form.inc
Format a textfield.
_theme_table_cell in includes/theme.inc

Code

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

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.