_element_info

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/form.inc, строка 1340

Версии
5 – 6
_element_info($type, $refresh = NULL)

Retrieve the default properties for the defined element type.

Связанные темы

▾ 4 функции вызывают _element_info()

drupal_prepare_form in includes/form.inc
Подготавливает полный массив формы, добавляя в него недостающие значения по-умолчанию, вызывая нужные хуки, а также, опционально, выставляя токены валидации для некоторых полей, чтобы обезопасить форму от несанкционированных вмешательств.
drupal_render in includes/common.inc
Формирует HTML-код из структурированного массива.
form_builder in 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 includes/form.inc
Expand weight elements into selects.

Код

<?php
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];
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему