drupal_render

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

includes/common.inc, строка 2814

Версии
5 – 6
drupal_render(&$elements)

Формирует HTML-код из структурированного массива.

Функция генерирует HTML-код, рекурсивно обходя каждый элемент массива. Обычно функция вызывается другими функциями, например drupal_get_form() или node_view().

Параметры

$elements Структурированный массив данных для отображения.

Возвращаемое значение

Сформированный HTML-код.

▾ 49 функции вызывают drupal_render()

book_form_update in modules/book/book.pages.inc
AJAX callback to replace the book parent select options.
book_node_export in modules/book/book.module
Generates printer-friendly HTML for a node. See alsobook_export_traverse()
drupal_render in includes/common.inc
Формирует HTML-код из структурированного массива.
drupal_render_form in includes/form.inc
Генерирует темизированный HTML-код из структурированного массива формы.
hook_search in developer/hooks/core.php
Определяет пользовательскую функцию поиска.
node_feed in modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
node_search in modules/node/node.module
Реализация hook_search().
node_view in modules/node/node.module
Генерирует вывод ноды.
poll_block in modules/poll/poll.module
Реализация hook_block().
poll_choice_js in modules/poll/poll.module
Коллбэк меню для AHAH добавления пунктов.
template_preprocess_block_admin_display_form in modules/block/block.admin.inc
Process variables for block-admin-display.tpl.php.
template_preprocess_poll_vote in modules/poll/poll.module
Themes the voting form for a poll.
template_preprocess_search_block_form in modules/search/search.module
Обрабатывает переменные для search-block-form.tpl.php.
template_preprocess_search_theme_form in modules/search/search.module
Process variables for search-theme-form.tpl.php.
template_preprocess_user_profile in modules/user/user.pages.inc
Обрабатывает переменные для user-profile.tpl.php.
theme_aggregator_categorize_items in modules/aggregator/aggregator.pages.inc
Theme the page list form for assigning categories.
theme_book_admin_table in modules/book/book.admin.inc
Theme function for the book administration page form. See alsobook_admin_table()
theme_color_scheme_form in modules/color/color.module
Темизирует форму выбора расцветки темы оформления.
theme_comment_admin_overview in modules/comment/comment.admin.inc
Темизирует форму комментирования администратора.
theme_comment_controls in modules/comment/comment.module
Темизирует область(бокс) контроля комментариев, где пользователь может изменить отображение по умолчанию и упорядочить их показ.
theme_dblog_filters in modules/dblog/dblog.module
Theme dblog administration filter selector.
theme_filter_admin_order in modules/filter/filter.admin.inc
Темизирует форму конфигурации порядка фильтров.
theme_filter_admin_overview in modules/filter/filter.admin.inc
Theme the admin overview form.
theme_locale_languages_overview_form in includes/locale.inc
Темизирует форму обзора языков сайта.
theme_menu_overview_form in modules/menu/menu.admin.inc
Theme the menu overview form into a table.
theme_node_admin_nodes in modules/node/node.admin.inc
Theme node administration overview.
theme_node_filters in modules/node/node.admin.inc
Theme node administration filter selector.
theme_node_filter_form in modules/node/node.admin.inc
Theme node administration filter form.
theme_node_form in modules/node/node.pages.inc
Выводит форму добавления ноды.
theme_node_search_admin in modules/node/node.module
Theme the content ranking part of the search settings admin page.
theme_poll_choices in modules/poll/poll.module
Theme the admin poll form for choices.
theme_profile_admin_overview in modules/profile/profile.admin.inc
Theme the profile field overview into a drag and drop enabled table. See alsoprofile_admin_overview()
theme_system_modules in modules/system/system.admin.inc
Темизирует форму модулей.
theme_system_modules_uninstall in modules/system/system.admin.inc
Темизирует таблицу отключенных на данный момент модулей.
theme_system_themes_form in modules/system/system.admin.inc
Theme function for the system themes form.
theme_system_theme_select_form in modules/system/system.admin.inc
Темизирует форму выбора темы.
theme_taxonomy_overview_terms in modules/taxonomy/taxonomy.admin.inc
Темизирует обзор терминов как сортируемый список.
theme_taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
Темизирует обзор словарей как сортируемый список.
theme_trigger_display in modules/trigger/trigger.admin.inc
Display actions assigned to this hook-op combination in a table.
theme_upload_form_current in modules/upload/upload.module
Темизирует список прикрепленных файлов (вложений).
theme_upload_form_new in modules/upload/upload.module
Темизирует форму для прикрепления вложений.
theme_user_admin_account in modules/user/user.admin.inc
Theme user administration overview.
theme_user_admin_new_role in modules/user/user.admin.inc
Theme the new-role form.
theme_user_admin_perm in modules/user/user.admin.inc
Темизирует страницу управления разрешениями.
theme_user_filters in modules/user/user.admin.inc
Theme user administration filter selector.
theme_user_filter_form in modules/user/user.admin.inc
Theme user administration filter form.
theme_user_profile in developer/theme.php
Темизирует страницу профиля пользователя.
upload_js in modules/upload/upload.module
Коллбэк меню для JavaScript загрузок файлов.
_node_index_node in modules/node/node.module
Индексирует одну ноду.

Код

<?php
function drupal_render(&$elements) {
  if (!isset($elements) || (isset($elements['#access']) && !$elements['#access'])) {
    return NULL;
  }

  // If the default values for this element haven't been loaded yet, populate
  // them.
  if (!isset($elements['#defaults_loaded']) || !$elements['#defaults_loaded']) {
    if ((!empty($elements['#type'])) && ($info = _element_info($elements['#type']))) {
      $elements += $info;
    }
  }

  // Make any final changes to the element before it is rendered. This means
  // that the $element or the children can be altered or corrected before the
  // element is rendered into the final text.
  if (isset($elements['#pre_render'])) {
    foreach ($elements['#pre_render'] as $function) {
      if (function_exists($function)) {
        $elements = $function($elements);
      }
    }
  }

  $content = '';
  // Either the elements did not go through form_builder or one of the children
  // has a #weight.
  if (!isset($elements['#sorted'])) {
    uasort($elements, "element_sort");
  }
  $elements += array('#title' => NULL, '#description' => NULL);
  if (!isset($elements['#children'])) {
    $children = element_children($elements);
    // Render all the children that use a theme function.
    if (isset($elements['#theme']) && empty($elements['#theme_used'])) {
      $elements['#theme_used'] = TRUE;

      $previous = array();
      foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {
        $previous[$key] = isset($elements[$key]) ? $elements[$key] : NULL;
      }
      // If we rendered a single element, then we will skip the renderer.
      if (empty($children)) {
        $elements['#printed'] = TRUE;
      }
      else {
        $elements['#value'] = '';
      }
      $elements['#type'] = 'markup';

      unset($elements['#prefix'], $elements['#suffix']);
      $content = theme($elements['#theme'], $elements);

      foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {
        $elements[$key] = isset($previous[$key]) ? $previous[$key] : NULL;
      }
    }
    // Render each of the children using drupal_render and concatenate them.
    if (!isset($content) || $content === '') {
      foreach ($children as $key) {
        $content .= drupal_render($elements[$key]);
      }
    }
  }
  if (isset($content) && $content !== '') {
    $elements['#children'] = $content;
  }

  // Until now, we rendered the children, here we render the element itself
  if (!isset($elements['#printed'])) {
    $content = theme(!empty($elements['#type']) ? $elements['#type'] : 'markup', $elements);
    $elements['#printed'] = TRUE;
  }

  if (isset($content) && $content !== '') {
    // Filter the outputted content and make any last changes before the
    // content is sent to the browser. The changes are made on $content
    // which allows the output'ed text to be filtered.
    if (isset($elements['#post_render'])) {
      foreach ($elements['#post_render'] as $function) {
        if (function_exists($function)) {
          $content = $function($content, $elements);
        }
      }
    }
    $prefix = isset($elements['#prefix']) ? $elements['#prefix'] : '';
    $suffix = isset($elements['#suffix']) ? $elements['#suffix'] : '';
    return $prefix . $content . $suffix;
  }
}
?>

Пользовательские комментарии

Примерр использования функции: http://www.drupal.ru/node/27601

Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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