1 common.inc element_info($type)

Retrieves the default properties for the defined element type.


$type: An element type as defined by hook_element_info().

Return value

array: The element information array from hook_element_info().


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


function element_info($type) {
  // Use the advanced backdrop_static() pattern, since this is called very often.
  static $backdrop_static_fast;
  if (!isset($backdrop_static_fast)) {
    $backdrop_static_fast['cache'] = &backdrop_static(__FUNCTION__);
  $cache = &$backdrop_static_fast['cache'];

  if (!isset($cache)) {
    $cache = module_invoke_all('element_info');
    foreach ($cache as $element_type => $info) {
      $cache[$element_type]['#type'] = $element_type;
    // Allow modules to alter the element type defaults.
    backdrop_alter('element_info', $cache);

  return isset($cache[$type]) ? $cache[$type] : array();