Commit 57fe5103 authored by Dries's avatar Dries
Browse files

- Patch #252013 by Eaton, pwolanin, Susurrus et al: drupal_render() now...

- Patch #252013 by Eaton, pwolanin, Susurrus et al: drupal_render() now printes #markup, not #value.
parent 11b9f390
......@@ -2741,26 +2741,15 @@ function drupal_render(&$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['#markup'] = '';
}
$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 === '') {
......
......@@ -1836,7 +1836,7 @@ function form_expand_ahah($element) {
* @ingroup themeable
*/
function theme_item($element) {
return theme('form_element', $element, $element['#value'] . (!empty($element['#children']) ? $element['#children'] : ''));
return theme('form_element', $element, $element['#markup'] . (!empty($element['#children']) ? $element['#children'] : ''));
}
/**
......@@ -2085,7 +2085,7 @@ function theme_textarea($element) {
*/
function theme_markup($element) {
return (isset($element['#value']) ? $element['#value'] : '') . (isset($element['#children']) ? $element['#children'] : '');
return (isset($element['#markup']) ? $element['#markup'] : '') . (isset($element['#children']) ? $element['#children'] : '');
}
/**
......
......@@ -46,9 +46,9 @@ function locale_languages_overview_form() {
'#type' => 'weight',
'#default_value' => $language->weight
);
$form['name'][$langcode] = array('#value' => check_plain($language->name));
$form['native'][$langcode] = array('#value' => check_plain($language->native));
$form['direction'][$langcode] = array('#value' => ($language->direction == LANGUAGE_RTL ? t('Right to left') : t('Left to right')));
$form['name'][$langcode] = array('#markup' => check_plain($language->name));
$form['native'][$langcode] = array('#markup' => check_plain($language->native));
$form['direction'][$langcode] = array('#markup' => ($language->direction == LANGUAGE_RTL ? t('Right to left') : t('Left to right')));
}
$form['enabled'] = array('#type' => 'checkboxes',
'#options' => $options,
......@@ -230,7 +230,7 @@ function _locale_languages_common_controls(&$form, $language = NULL) {
$form['langcode_view'] = array(
'#type' => 'item',
'#title' => t('Language code'),
'#value' => $language->language
'#markup' => $language->language
);
$form['langcode'] = array(
'#type' => 'value',
......@@ -782,7 +782,7 @@ function locale_translate_edit_form(&$form_state, $lid) {
'original' => array(
'#type' => 'item',
'#title' => t('Original text'),
'#value' => check_plain(wordwrap($source->source, 0)),
'#markup' => check_plain(wordwrap($source->source, 0)),
),
'lid' => array(
'#type' => 'value',
......
......@@ -231,7 +231,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting
if (count($db_types) == 0) {
$form['no_db_types'] = array(
'#value' => st('Your web server does not appear to support any common database types. Check with your hosting provider to see if they offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array('@drupal-databases' => 'http://drupal.org/node/270#database')),
'#markup' => st('Your web server does not appear to support any common database types. Check with your hosting provider to see if they offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array('@drupal-databases' => 'http://drupal.org/node/270#database')),
);
}
else {
......@@ -995,7 +995,7 @@ function install_task_list($active = NULL) {
function install_configure_form(&$form_state, $url) {
$form['intro'] = array(
'#value' => st('To configure your website, please provide the following information.'),
'#markup' => st('To configure your website, please provide the following information.'),
'#weight' => -10,
);
$form['site_information'] = array(
......@@ -1024,7 +1024,7 @@ function install_configure_form(&$form_state, $url) {
);
$form['admin_account']['account']['#tree'] = TRUE;
$form['admin_account']['markup'] = array(
'#value' => '<p class="description">' . st('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.') . '</p>',
'#markup' => '<p class="description">' . st('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.') . '</p>',
'#weight' => -10,
);
......
......@@ -157,7 +157,7 @@ function aggregator_categorize_items($items, $feed_source = '') {
'#tree' => TRUE,
);
foreach ($items as $item) {
$form['items'][$item->iid] = array('#value' => theme('aggregator_item', $item));
$form['items'][$item->iid] = array('#markup' => theme('aggregator_item', $item));
$form['categories'][$item->iid] = array();
$categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = %d', $item->iid);
$selected = array();
......
......@@ -53,7 +53,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
'#value' => $block['delta'],
);
$form[$key]['info'] = array(
'#value' => check_plain($block['info']),
'#markup' => check_plain($block['info']),
);
$form[$key]['theme'] = array(
'#type' => 'hidden',
......@@ -69,7 +69,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
'#options' => $block_regions,
);
$form[$key]['configure'] = array(
'#value' => l(t('configure'),
'#markup' => l(t('configure'),
'admin/build/block/configure/' . $block['module'] . '/' . $block['delta']),
);
if ($block['module'] == 'block') {
......
......@@ -49,7 +49,7 @@ function blog_user($type, &$edit, &$user) {
$user->content['summary']['blog'] = array(
'#type' => 'user_profile_item',
'#title' => t('Blog'),
'#value' => l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $user->name))))),
'#markup' => l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => $user->name))))),
'#attributes' => array('class' => 'blog'),
);
}
......
......@@ -692,7 +692,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) {
if (!$teaser) {
if (!empty($node->book['bid']) && $node->build_mode == NODE_BUILD_NORMAL) {
$node->content['book_navigation'] = array(
'#value' => theme('book_navigation', $node->book),
'#markup' => theme('book_navigation', $node->book),
'#weight' => 100,
);
......@@ -790,7 +790,7 @@ function book_form_node_delete_confirm_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
'#value' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
'#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
'#weight' => -10,
);
}
......
......@@ -57,7 +57,7 @@ function color_form_alter(&$form, $form_state, $form_id) {
foreach (element_children($form) as $theme) {
if ($screenshot = variable_get('color_' . $theme . '_screenshot', NULL)) {
if (isset($form[$theme]['screenshot'])) {
$form[$theme]['screenshot']['#value'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
$form[$theme]['screenshot']['#markup'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
}
}
}
......
......@@ -76,19 +76,19 @@ function comment_admin_overview($type = 'new', $arg) {
$comments[$comment->cid] = '';
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$form['subject'][$comment->cid] = array(
'#value' => l($comment->subject, 'node/' . $comment->nid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid))
'#markup' => l($comment->subject, 'node/' . $comment->nid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid))
);
$form['username'][$comment->cid] = array(
'#value' => theme('username', $comment)
'#markup' => theme('username', $comment)
);
$form['node_title'][$comment->cid] = array(
'#value' => l($comment->node_title, 'node/' . $comment->nid)
'#markup' => l($comment->node_title, 'node/' . $comment->nid)
);
$form['timestamp'][$comment->cid] = array(
'#value' => format_date($comment->timestamp, 'small')
'#markup' => format_date($comment->timestamp, 'small')
);
$form['operations'][$comment->cid] = array(
'#value' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination))
'#markup' => l(t('edit'), 'comment/edit/' . $comment->cid, array('query' => $destination))
);
}
$form['comments'] = array(
......@@ -96,7 +96,7 @@ function comment_admin_overview($type = 'new', $arg) {
'#options' => isset($comments) ? $comments: array()
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0)
'#markup' => theme('pager', NULL, 50, 0)
);
return $form;
......@@ -169,7 +169,7 @@ function theme_comment_admin_overview($form) {
}
$output .= theme('table', $form['header']['#value'], $rows);
if ($form['pager']['#value']) {
if ($form['pager']['#markup']) {
$output .= drupal_render($form['pager']);
}
......
......@@ -1267,7 +1267,7 @@ function comment_form(&$form_state, $edit, $title = NULL) {
$form['_author'] = array(
'#type' => 'item',
'#title' => t('Your name'),
'#value' => theme('username', $user),
'#markup' => theme('username', $user),
);
$form['author'] = array(
'#type' => 'value',
......@@ -1452,7 +1452,7 @@ function comment_form_add_preview($form, &$form_state) {
}
$form['comment_preview'] = array(
'#value' => $output,
'#markup' => $output,
'#weight' => -100,
'#prefix' => '<div class="preview">',
'#suffix' => '</div>',
......@@ -1473,7 +1473,7 @@ function comment_form_add_preview($form, &$form_state) {
}
$form['comment_preview_below'] = array(
'#value' => $output,
'#markup' => $output,
'#weight' => 100,
);
......
......@@ -38,7 +38,7 @@ function contact_mail_page() {
if (count($categories) > 0) {
$form['#token'] = $user->uid ? $user->name . $user->mail : '';
$form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.'))));
$form['contact_information'] = array('#markup' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.'))));
$form['name'] = array('#type' => 'textfield',
'#title' => t('Your name'),
'#maxlength' => 255,
......@@ -177,11 +177,11 @@ function contact_mail_user(&$form_state, $recipient) {
$form['recipient'] = array('#type' => 'value', '#value' => $recipient);
$form['from'] = array('#type' => 'item',
'#title' => t('From'),
'#value' => check_plain($user->name) . ' &lt;' . check_plain($user->mail) . '&gt;',
'#markup' => check_plain($user->name) . ' &lt;' . check_plain($user->mail) . '&gt;',
);
$form['to'] = array('#type' => 'item',
'#title' => t('To'),
'#value' => check_plain($recipient->name),
'#markup' => check_plain($recipient->name),
);
$form['subject'] = array('#type' => 'textfield',
'#title' => t('Subject'),
......
......@@ -30,10 +30,10 @@ function filter_admin_overview() {
}
$default = ($id == variable_get('filter_default_format', 1));
$options[$id] = '';
$form[$id]['name'] = array('#value' => $format->name);
$form[$id]['roles'] = array('#value' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')));
$form[$id]['configure'] = array('#value' => l(t('configure'), 'admin/settings/filters/' . $id));
$form[$id]['delete'] = array('#value' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id));
$form[$id]['name'] = array('#markup' => $format->name);
$form[$id]['roles'] = array('#markup' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')));
$form[$id]['configure'] = array('#markup' => l(t('configure'), 'admin/settings/filters/' . $id));
$form[$id]['delete'] = array('#markup' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id));
$form[$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
}
$form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
......@@ -166,7 +166,7 @@ function filter_admin_format_form(&$form_state, $format) {
}
$group = '<p>' . t('These are the guidelines that users will see for posting in this input format. They are automatically generated from the filter settings.') . '</p>';
$group .= $tiplist;
$form['tips'] = array('#value' => '<h2>' . t('Formatting guidelines') . '</h2>' . $group);
$form['tips'] = array('#markup' => '<h2>' . t('Formatting guidelines') . '</h2>' . $group);
}
$form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
......@@ -325,7 +325,7 @@ function filter_admin_configure(&$form_state, $format) {
$form = system_settings_form($form);
}
else {
$form['error'] = array('#value' => t('No settings are available.'));
$form['error'] = array('#markup' => t('No settings are available.'));
}
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
$form['#submit'][] = 'filter_admin_configure_submit';
......@@ -360,7 +360,7 @@ function filter_admin_order(&$form_state, $format = NULL) {
$form['weights'] = array('#tree' => TRUE);
foreach ($filters as $id => $filter) {
$form['names'][$id] = array('#value' => $filter->name);
$form['names'][$id] = array('#markup' => $filter->name);
$form['weights'][$id] = array('#type' => 'weight', '#default_value' => $filter->weight);
}
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
......
......@@ -508,10 +508,10 @@ function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents =
$tips = _filter_tips(variable_get('filter_default_format', 1), FALSE);
$form['format']['guidelines'] = array(
'#title' => t('Formatting guidelines'),
'#value' => theme('filter_tips', $tips, FALSE, $extra),
'#markup' => theme('filter_tips', $tips, FALSE, $extra),
);
}
$form[] = array('#value' => $extra);
$form[] = array('#markup' => $extra);
return $form;
}
......
......@@ -225,12 +225,12 @@ function forum_overview(&$form_state) {
foreach (element_children($form) as $key) {
if (isset($form[$key]['#term'])) {
$term = $form[$key]['#term'];
$form[$key]['view']['#value'] = l($term['name'], 'forum/' . $term['tid']);
$form[$key]['view']['#markup'] = l($term['name'], 'forum/' . $term['tid']);
if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
$form[$key]['edit']['#value'] = l(t('edit container'), 'admin/build/forum/edit/container/' . $term['tid']);
$form[$key]['edit']['#markup'] = l(t('edit container'), 'admin/build/forum/edit/container/' . $term['tid']);
}
else {
$form[$key]['edit']['#value'] = l(t('edit forum'), 'admin/build/forum/edit/forum/' . $term['tid']);
$form[$key]['edit']['#markup'] = l(t('edit forum'), 'admin/build/forum/edit/forum/' . $term['tid']);
}
}
}
......
......@@ -199,7 +199,7 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
if (!$teaser) {
$node->content['forum_navigation'] = array(
'#value' => theme('forum_topic_navigation', $node),
'#markup' => theme('forum_topic_navigation', $node),
'#weight' => 100,
);
}
......@@ -360,7 +360,7 @@ function forum_form_alter(&$form, $form_state, $form_id) {
// Hide critical options from forum vocabulary.
if ($form_id == 'taxonomy_form_vocabulary') {
$form['help_forum_vocab'] = array(
'#value' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'),
'#markup' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'),
'#weight' => -1,
);
$form['content_types']['nodes']['#required'] = TRUE;
......
......@@ -51,7 +51,7 @@ function menu_overview_form(&$form_state, $menu) {
);
}
else {
$form['empty_menu'] = array('#value' => t('There are no menu items yet.'));
$form['empty_menu'] = array('#markup' => t('There are no menu items yet.'));
}
return $form;
}
......@@ -69,7 +69,7 @@ function _menu_overview_tree_form($tree) {
$mlid = 'mlid:' . $item['mlid'];
$form[$mlid]['#item'] = $item;
$form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => 'menu-disabled') : array('class' => 'menu-enabled');
$form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' (' . t('disabled') . ')' : '');
$form[$mlid]['title']['#markup'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' (' . t('disabled') . ')' : '');
$form[$mlid]['hidden'] = array(
'#type' => 'checkbox',
'#default_value' => !$item['hidden'],
......@@ -106,7 +106,7 @@ function _menu_overview_tree_form($tree) {
$form[$mlid]['operations'] = array();
foreach ($operations as $op => $value) {
$form[$mlid]['operations'][$op] = array('#value' => $value);
$form[$mlid]['operations'][$op] = array('#markup' => $value);
}
}
......@@ -600,7 +600,7 @@ function menu_reset_item_confirm_submit($form, &$form_state) {
function menu_configure() {
$form['intro'] = array(
'#type' => 'item',
'#value' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option sets the default menu in which a new link will be added.'),
'#markup' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option sets the default menu in which a new link will be added.'),
);
$menu_options = menu_get_menus();
......@@ -635,4 +635,3 @@ function menu_configure() {
return system_settings_form($form);
}
......@@ -94,7 +94,7 @@ function node_type_form(&$form_state, $type = NULL) {
$form['identity']['type_display'] = array(
'#title' => t('Type'),
'#type' => 'item',
'#value' => theme('placeholder', $type->type),
'#markup' => theme('placeholder', $type->type),
'#description' => t('The machine-readable name of this content type. This field cannot be modified for system-defined content types.'),
);
}
......
......@@ -21,7 +21,7 @@ function node_configure() {
'#type' => 'fieldset',
'#title' => t('Node access status'),
);
$form['access']['status'] = array('#value' => $status);
$form['access']['status'] = array('#markup' => $status);
$form['access']['rebuild'] = array(
'#type' => 'submit',
'#value' => t('Rebuild permissions'),
......@@ -236,10 +236,10 @@ function node_filter_form() {
$value = $filters[$type]['options'][$value];
}
if ($i++) {
$form['filters']['current'][] = array('#value' => t('<em>and</em> where <strong>%a</strong> is <strong>%b</strong>', array('%a' => $filters[$type]['title'], '%b' => $value)));
$form['filters']['current'][] = array('#markup' => t('<em>and</em> where <strong>%a</strong> is <strong>%b</strong>', array('%a' => $filters[$type]['title'], '%b' => $value)));
}
else {
$form['filters']['current'][] = array('#value' => t('<strong>%a</strong> is <strong>%b</strong>', array('%a' => $filters[$type]['title'], '%b' => $value)));
$form['filters']['current'][] = array('#markup' => t('<strong>%a</strong> is <strong>%b</strong>', array('%a' => $filters[$type]['title'], '%b' => $value)));
}
if (in_array($type, array('type', 'language'))) {
// Remove the option if it is already being filtered on.
......@@ -495,17 +495,17 @@ function node_admin_nodes() {
while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = '';
$options = empty($node->language) ? array() : array('language' => $languages[$node->language]);
$form['title'][$node->nid] = array('#value' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed)));
$form['name'][$node->nid] = array('#value' => check_plain(node_get_types('name', $node)));
$form['username'][$node->nid] = array('#value' => theme('username', $node));
$form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published')));
$form['title'][$node->nid] = array('#markup' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed)));
$form['name'][$node->nid] = array('#markup' => check_plain(node_get_types('name', $node)));
$form['username'][$node->nid] = array('#markup' => theme('username', $node));
$form['status'][$node->nid] = array('#markup' => ($node->status ? t('published') : t('not published')));
if ($multilanguage) {
$form['language'][$node->nid] = array('#value' => empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name));
$form['language'][$node->nid] = array('#markup' => empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name));
}
$form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array('query' => $destination)));
$form['operations'][$node->nid] = array('#markup' => l(t('edit'), 'node/' . $node->nid . '/edit', array('query' => $destination)));
}
$form['nodes'] = array('#type' => 'checkboxes', '#options' => $nodes);
$form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
$form['pager'] = array('#markup' => theme('pager', NULL, 50, 0));
$form['#theme'] = 'node_admin_nodes';
return $form;
}
......@@ -592,7 +592,7 @@ function theme_node_admin_nodes($form) {
}
$output .= theme('table', $header, $rows);
if ($form['pager']['#value']) {
if ($form['pager']['#markup']) {
$output .= drupal_render($form['pager']);
}
......@@ -632,4 +632,3 @@ function node_multiple_delete_confirm_submit($form, &$form_state) {
$form_state['redirect'] = 'admin/content/node';
return;
}
......@@ -1074,7 +1074,7 @@ function node_prepare($node, $teaser = FALSE) {
}
$node->content['body'] = array(
'#value' => $teaser ? $node->teaser : $node->body,
'#markup' => $teaser ? $node->teaser : $node->body,
'#weight' => 0,
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment