function _element_info

6.x form.inc _element_info($type, $refresh = NULL)

Retrieve the default properties for the defined element type.

Related topics

4 calls to _element_info()
drupal_prepare_form in drupal-6.x/includes/form.inc
Prepares a structured form array by adding required elements, executing any hook_form_alter functions, and optionally inserting a validation token to prevent tampering.
drupal_render in drupal-6.x/includes/common.inc
Renders HTML given a structured array tree.
form_builder in drupal-6.x/includes/form.inc
Walk through the structured form array, adding any required properties to each element and mapping the incoming $_POST data to the proper elements.
process_weight in drupal-6.x/includes/form.inc
Expand weight elements into selects.

File

drupal-6.x/includes/form.inc, line 1364

Code

function _element_info($type, $refresh = NULL) {
  static $cache;

  $basic_defaults = array(
    '#description' => NULL,
    '#attributes' => array(),
    '#required' => FALSE,
    '#tree' => FALSE,
    '#parents' => array()
  );
  if (!isset($cache) || $refresh) {
    $cache = array();
    foreach (module_implements('elements') as $module) {
      $elements = module_invoke($module, 'elements');
      if (isset($elements) && is_array($elements)) {
        $cache = array_merge_recursive($cache, $elements);
      }
    }
    if (sizeof($cache)) {
      foreach ($cache as $element_type => $info) {
        $cache[$element_type] = array_merge_recursive($basic_defaults, $info);
      }
    }
  }

  return $cache[$type];
}