8.5.x common.inc element_info($type)
8.0.x common.inc element_info($type)
8.1.x common.inc element_info($type)
8.2.x common.inc element_info($type)
8.3.x common.inc element_info($type)
8.4.x common.inc element_info($type)
8.6.x common.inc element_info($type)
7.x common.inc element_info($type)

Retrieves the default properties for the defined element type.

Parameters

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

7 calls to element_info()
drupal_prepare_form in includes/form.inc
Prepares a structured form array.
drupal_render in includes/common.inc
Renders HTML given a structured array tree.
drupal_render_page in includes/common.inc
Renders the page, including all theming.
element_info_property in includes/common.inc
Retrieves a single property for the defined element type.
file_field_widget_form in modules/file/file.field.inc
Implements hook_field_widget_form().

... See full list

File

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

Code

function element_info($type) {

  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['cache'] =& drupal_static(__FUNCTION__);
  }
  $cache =& $drupal_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.
    drupal_alter('element_info', $cache);
  }
  return isset($cache[$type]) ? $cache[$type] : array();
}

Comments