7 common.inc element_set_attributes(array &$element, array $map)
8 common.inc element_set_attributes(array &$element, array $map)

Sets HTML attributes based on element properties.


$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.


in Drupal 8.x-dev, will be removed before Drupal 8.0. Use \Drupal\Core\Render\Element::setAttributes().


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


function element_set_attributes(array &$element, array $map) {
  Element::setAttributes($element, $map);