function _bootstrap_get_attributes

8.x-3.x deprecated.php &_bootstrap_get_attributes(array &$element, $property = 'attributes')
7.x-3.x common.inc &_bootstrap_get_attributes(array &$element, $property = 'attributes')

Retrieves an element's "attributes" array.

Parameters

array $element: The individual renderable array element. It is possible to also pass the $variables parameter in [pre]process functions and it will logically determine the correct path to that particular theme hook's attribute array. Passed by reference.

string $property: Determines which attributes array to retrieve. By default, this is the normal attributes, but can be "wrapper_attributes" or "input_group_attributes".

Return value

array The attributes array. Passed by reference.

Related topics

Source includes/common.inc (line 492)

function &_bootstrap_get_attributes(array &$element, $property = 'attributes') {
  // Attempt to retrieve a renderable element attributes first.
  if (
  isset($element['#type']) || 
    isset($element['#theme']) || 
    isset($element['#pre_render']) || 
    isset($element['#markup']) || 
    isset($element['#theme_wrappers']) || 
    isset($element["#$property"])
    ) {
    if (!isset($element["#$property"])) {
      $element["#$property"] = array();
    }
    return $element["#$property"];
  }
  // Treat $element as if it were a [pre]process function $variables parameter
  // and look for a renderable "element".
  elseif (isset($element['element'])) {
    if (!isset($element['element']["#$property"])) {
      $element['element']["#$property"] = array();
    }
    return $element['element']["#$property"];
  }

  // If all else fails, create (if needed) a default "attributes" array. This
  // will, at the very least, either work or cause an error that can be tracked.
  if (!isset($element[$property])) {
    $element[$property] = array();
  }

  return $element[$property];
}