drupal_render

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

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

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

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

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

Параметры

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

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

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

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

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

book_node_visitor_html_pre in modules/book/book.module
Generates printer-friendly HTML for a node. This function is a 'pre-node' visitor function for book_recurse().
drupal_render in includes/common.inc
Формирует HTML-код из структурированного массива.
drupal_render_form in includes/form.inc
Renders a structured form array into themed HTML.
hook_search in developer/hooks/core.php
Определяет пользовательскую функцию поиска.
node_search in modules/node/node.module
Implementation of hook_search().
node_update_index in modules/node/node.module
Реализация hook_update_index().
node_view in modules/node/node.module
Генерирует вывод ноды.
poll_block in modules/poll/poll.module
Реализация hook_block().
theme_aggregator_page_list in modules/aggregator/aggregator.module
theme_block_admin_display in modules/block/block.module
Theme main block administration form submission.
theme_book_admin_table in modules/book/book.module
theme_color_scheme_form in modules/color/color.module
Theme color form.
theme_comment_admin_overview in modules/comment/comment.module
Темизирует форму комментирования администратора.
theme_comment_controls in modules/comment/comment.module
Темизирует область(бокс) контроля комментариев, где пользователь может изменить отображение по умолчанию и упорядочить их показ.
theme_filter_admin_order in modules/filter/filter.module
Темизирует форму конфигурации порядка фильтров.
theme_filter_admin_overview in modules/filter/filter.module
theme_locale_admin_manage_screen in includes/locale.inc
Theme the locale admin manager form.
theme_node_admin_nodes in modules/node/node.module
Theme node administration overview.
theme_node_filters in modules/node/node.module
Theme node administration filter selector.
theme_node_filter_form in modules/node/node.module
Theme node administration filter form.
theme_node_form in modules/node/node.module
theme_node_search_admin in modules/node/node.module
theme_poll_view_voting in modules/poll/poll.module
Themes the voting form for a poll.
theme_search_block_form in modules/search/search.module
Theme the block search form.
theme_search_theme_form in modules/search/search.module
Theme the theme search form.
theme_system_modules in modules/system/system.module
Темизирует форму модулей.
theme_system_modules_uninstall in modules/system/system.module
Темизирует таблицу отключенных на данный момент модулей.
theme_system_themes in modules/system/system.module
theme_system_theme_select_form in modules/system/system.module
Темизирует форму выбора темы.
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.module
Theme user administration overview.
theme_user_admin_new_role in modules/user/user.module
theme_user_admin_perm in modules/user/user.module
Темизирует страницу управления разрешениями.
theme_user_filters in modules/user/user.module
Theme user administration filter selector.
theme_user_filter_form in modules/user/user.module
Theme user administration filter form.
theme_watchdog_form_overview in modules/watchdog/watchdog.module
upload_js in modules/upload/upload.module
Коллбэк меню для JavaScript загрузок файлов.

Код

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

  $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");
  }
  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 !== '') {
    $prefix = isset($elements['#prefix']) ? $elements['#prefix'] : '';
    $suffix = isset($elements['#suffix']) ? $elements['#suffix'] : '';
    return $prefix . $content . $suffix;
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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