function element_set_attributes

cis7 common.inc element_set_attributes(array &$element, array $map)
cle7 common.inc element_set_attributes(array &$element, array $map)
elmsmedia7 common.inc element_set_attributes(array &$element, array $map)
icor7 common.inc element_set_attributes(array &$element, array $map)
meedjum_blog7 common.inc element_set_attributes(array &$element, array $map)
mooc7 common.inc element_set_attributes(array &$element, array $map)

Sets HTML attributes based on element properties.

Parameters

$element: The renderable element to process.

$map: An associative array whose keys are element property names and whose values are the HTML attribute names to set for corresponding the property; e.g., array('#propertyname' => 'attributename'). If both names are identical except for the leading '#', then an attribute name value is sufficient and no property name needs to be specified.

16 calls to element_set_attributes()
corolla_fieldset in sites/all/themes/ulmus/corolla/template.php
Returns HTML for a fieldset form element and its children.
theme_button in includes/form.inc
Returns HTML for a button form element.
theme_checkbox in includes/form.inc
Returns HTML for a checkbox form element.
theme_fieldset in includes/form.inc
Returns HTML for a fieldset form element and its children.
theme_file in includes/form.inc
Returns HTML for a file upload form element.

... See full list

File

includes/common.inc, line 6487
Common functions that many Drupal modules will need to reference.

Code

function element_set_attributes(array &$element, array $map) {
  foreach ($map as $property => $attribute) {
    // If the key is numeric, the attribute name needs to be taken over.
    if (is_int($property)) {
      $property = '#' . $attribute;
    }
    // Do not overwrite already existing attributes.
    if (isset($element[$property]) && !isset($element['#attributes'][$attribute])) {
      $element['#attributes'][$attribute] = $element[$property];
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.