function element_set_attributes

You are here

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.

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.

Deprecated

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

File

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

Code

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