Commit 29c8e40e authored by Dries's avatar Dries

- Patch #355236 by Frando: refactor drupal_render() theming.

parent 607e9626
This diff is collapsed.
This diff is collapsed.
......@@ -96,7 +96,7 @@ function theme_locale_languages_overview_form($form) {
}
$header = array(array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Code')), array('data' => t('Direction')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations')));
$output = theme('table', $header, $rows, array('id' => 'language-order'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
......
......@@ -1584,7 +1584,7 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
*/
function theme_list($elements) {
// Populate any missing array elements with their defaults.
$elements += _element_info('list');
$elements += element_info('list');
return theme('item_list', $elements['#items'], $elements['#title'], $elements['#list_type'], $elements['#attributes']);
}
......
......@@ -250,7 +250,7 @@ function theme_aggregator_categorize_items($form) {
}
$output .= theme('table', array('', t('Categorize')), $rows);
$output .= drupal_render($form['submit']);
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return theme('aggregator_wrapper', $output);
}
......
......@@ -403,5 +403,5 @@ function template_preprocess_block_admin_display_form(&$variables) {
}
}
$variables['form_submit'] = drupal_render($variables['form']);
$variables['form_submit'] = drupal_render_children($variables['form']);
}
......@@ -239,7 +239,7 @@ function theme_color_scheme_form($form) {
}
$output .= '</div>';
// Preview
$output .= drupal_render($form);
$output .= drupal_render_children($form);
$output .= '<h2>' . t('Preview') . '</h2>';
$output .= '<div id="preview"><div id="text"><h2>Lorem ipsum dolor</h2><p>Sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud <a href="#">exercitation ullamco</a> laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div><div id="img" style="background-image: url(' . base_path() . $path . $info['preview_image'] . ')"></div></div>';
// Close the wrapper div.
......
......@@ -82,7 +82,7 @@ function theme_filter_admin_overview($form) {
}
$header = array(t('Name'), t('Roles'), t('Default'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2));
$output = theme('table', $header, $rows, array('id' => 'input-format-order'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
drupal_add_tabledrag('input-format-order', 'order', 'sibling', 'input-format-order-weight');
......@@ -391,7 +391,7 @@ function theme_filter_admin_order($form) {
}
$output = theme('table', $header, $rows, array('id' => 'filter-order'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
drupal_add_tabledrag('filter-order', 'order', 'sibling', 'filter-order-weight', NULL, NULL, FALSE);
......
......@@ -216,7 +216,7 @@ function theme_menu_overview_form($form) {
if ($rows) {
$output .= theme('table', $header, $rows, array('id' => 'menu-overview'));
}
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......
......@@ -269,7 +269,7 @@ function theme_node_filter_form($form) {
$output .= '<div id="node-admin-filter">';
$output .= drupal_render($form['filters']);
$output .= '</div>';
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -616,7 +616,7 @@ function theme_node_admin_nodes($form) {
$output .= drupal_render($form['pager']);
}
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......
......@@ -1612,7 +1612,7 @@ function theme_node_search_admin($form) {
}
$output .= theme('table', $header, $rows);
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -3138,7 +3138,7 @@ function node_list_permissions($type) {
* Implementation of hook_elements().
*/
function node_elements() {
$type['node_links'] = array();
$type['node_links'] = array('#theme' => 'node_links');
return $type;
}
......
......@@ -335,7 +335,7 @@ function theme_node_form($form) {
$output = "\n<div class=\"node-form\">\n";
$output .= " <div class=\"standard\">\n";
$output .= drupal_render($form);
$output .= drupal_render_children($form);
$output .= " </div>\n";
$output .= "</div>\n";
......
......@@ -624,7 +624,7 @@ function template_preprocess_poll_vote(&$variables) {
$variables['choice'] = drupal_render($form['choice']);
$variables['title'] = check_plain($form['#node']->title);
$variables['vote'] = drupal_render($form['vote']);
$variables['rest'] = drupal_render($form);
$variables['rest'] = drupal_render_children($form);
$variables['block'] = $form['#block'];
// If this is a block, allow a different tpl.php to be used.
if ($variables['block']) {
......@@ -698,7 +698,7 @@ function theme_poll_choices($form) {
}
$output = theme('table', $headers, $rows, array('id' => 'poll-choice-table'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......
......@@ -152,7 +152,7 @@ function theme_profile_admin_overview($form) {
$header[] = array('data' => t('Operations'), 'colspan' => 2);
$output = theme('table', $header, $rows, array('id' => 'profile-fields'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......
......@@ -2174,7 +2174,7 @@ function theme_system_modules_uninstall($form) {
}
$output = theme('table', $header, $rows);
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -2256,6 +2256,6 @@ function theme_system_themes_form($form) {
$header = array(t('Screenshot'), t('Name'), t('Version'), t('Enabled'), t('Default'), t('Operations'));
$output = theme('table', $header, $rows);
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -235,6 +235,7 @@ function system_elements() {
$type['form'] = array(
'#method' => 'post',
'#action' => request_uri(),
'#theme_wrapper' => 'form',
);
$type['page'] = array(
......@@ -259,6 +260,7 @@ function system_elements() {
'#button_type' => 'submit',
'#executes_submit_callback' => TRUE,
'#process' => array('form_process_ahah'),
'#theme_wrapper' => 'button',
);
$type['button'] = array(
......@@ -267,6 +269,7 @@ function system_elements() {
'#button_type' => 'submit',
'#executes_submit_callback' => FALSE,
'#process' => array('form_process_ahah'),
'#theme_wrapper' => 'button',
);
$type['image_button'] = array(
......@@ -277,6 +280,7 @@ function system_elements() {
'#return_value' => TRUE,
'#has_garbage_value' => TRUE,
'#src' => NULL,
'#theme_wrapper' => 'image_button',
);
$type['textfield'] = array(
......@@ -285,6 +289,8 @@ function system_elements() {
'#maxlength' => 128,
'#autocomplete_path' => FALSE,
'#process' => array('form_process_input_format', 'form_process_ahah'),
'#theme' => 'textfield',
'#theme_wrapper' => 'form_element',
);
$type['password'] = array(
......@@ -292,11 +298,14 @@ function system_elements() {
'#size' => 60,
'#maxlength' => 128,
'#process' => array('form_process_ahah'),
'#theme' => 'password',
'#theme_wrapper' => 'form_element',
);
$type['password_confirm'] = array(
'#input' => TRUE,
'#process' => array('form_process_password_confirm'),
'#theme_wrapper' => 'form_element',
);
$type['textarea'] = array(
......@@ -305,29 +314,41 @@ function system_elements() {
'#rows' => 5,
'#resizable' => TRUE,
'#process' => array('form_process_input_format', 'form_process_ahah'),
'#theme' => 'textarea',
'#theme_wrapper' => 'form_element',
);
$type['radios'] = array(
'#input' => TRUE,
'#process' => array('form_process_radios'),
'#theme_wrapper' => 'radios',
'#pre_render' => array('form_pre_render_conditional_form_element'),
);
$type['radio'] = array(
'#input' => TRUE,
'#default_value' => NULL,
'#process' => array('form_process_ahah'),
'#theme' => 'radio',
'#theme_wrapper' => 'form_element',
'#form_element_skip_title' => TRUE,
);
$type['checkboxes'] = array(
'#input' => TRUE,
'#tree' => TRUE,
'#process' => array('form_process_checkboxes'),
'#theme_wrapper' => 'checkboxes',
'#pre_render' => array('form_pre_render_conditional_form_element'),
);
$type['checkbox'] = array(
'#input' => TRUE,
'#return_value' => 1,
'#process' => array('form_process_ahah'),
'#theme' => 'checkbox',
'#theme_wrapper' => 'form_element',
'#form_element_skip_title' => TRUE,
);
$type['select'] = array(
......@@ -335,6 +356,8 @@ function system_elements() {
'#size' => 0,
'#multiple' => FALSE,
'#process' => array('form_process_ahah'),
'#theme' => 'select',
'#theme_wrapper' => 'form_element',
);
$type['weight'] = array(
......@@ -348,11 +371,15 @@ function system_elements() {
'#input' => TRUE,
'#element_validate' => array('date_validate'),
'#process' => array('form_process_date'),
'#theme' => 'date',
'#theme_wrapper' => 'form_element',
);
$type['file'] = array(
'#input' => TRUE,
'#size' => 60,
'#theme' => 'file',
'#theme_wrapper' => 'form_element',
);
$type['tableselect'] = array(
'#input' => TRUE,
......@@ -361,6 +388,7 @@ function system_elements() {
'#process' => array('form_process_tableselect'),
'#options' => array(),
'#empty' => '',
'#theme' => 'tableselect'
);
/**
......@@ -368,11 +396,14 @@ function system_elements() {
*/
$type['item'] = array(
'#markup' => '',
'#theme' => 'markup',
'#theme_wrapper' => 'form_element',
);
$type['hidden'] = array(
'#input' => TRUE,
'#process' => array('form_process_ahah'),
'#theme' => 'hidden',
);
$type['value'] = array(
......@@ -380,8 +411,8 @@ function system_elements() {
);
$type['markup'] = array(
'#prefix' => '',
'#suffix' => '',
'#markup' => '',
'#theme' => 'markup',
);
$type['fieldset'] = array(
......@@ -389,10 +420,12 @@ function system_elements() {
'#collapsed' => FALSE,
'#value' => NULL,
'#process' => array('form_process_ahah'),
'#theme_wrapper' => 'fieldset',
);
$type['token'] = array(
'#input' => TRUE,
'#theme' => array('hidden'),
);
return $type;
......
......@@ -91,7 +91,7 @@ function theme_taxonomy_overview_vocabularies($form) {
drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight');
}
$header[] = array('data' => t('Operations'), 'colspan' => '3');
return theme('table', $header, $rows, array('id' => 'taxonomy')) . drupal_render($form);
return theme('table', $header, $rows, array('id' => 'taxonomy')) . drupal_render_children($form);
}
/**
......@@ -605,7 +605,7 @@ function theme_taxonomy_overview_terms($form) {
$header = array(t('Name'), t('Operations'));
$output = theme('table', $header, $rows, array('id' => 'taxonomy'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
$output .= theme('pager', NULL, $page_increment);
return $output;
......
......@@ -246,10 +246,10 @@ function theme_trigger_display($element) {
}
if (count($rows)) {
$output = theme('table', $header, $rows) . drupal_render($element);
$output = theme('table', $header, $rows) . drupal_render_children($element);
}
else {
$output = drupal_render($element);
$output = drupal_render_children($element);
}
return $output;
}
......
......@@ -621,7 +621,7 @@ function theme_upload_form_current($form) {
$rows[] = array('data' => $row, 'class' => 'draggable');
}
$output = theme('table', $header, $rows, array('id' => 'upload-attachments'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -633,7 +633,7 @@ function theme_upload_form_current($form) {
*/
function theme_upload_form_new($form) {
drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
$output = drupal_render($form);
$output = drupal_render_children($form);
return $output;
}
......
......@@ -651,7 +651,7 @@ function theme_user_admin_perm($form) {
}
$output = theme('system_compact_link');
$output .= theme('table', $header, $rows, array('id' => 'permissions'));
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -788,7 +788,7 @@ function theme_user_admin_account($form) {
$output .= drupal_render($form['pager']);
}
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......@@ -811,7 +811,7 @@ function theme_user_admin_new_role($form) {
}
$rows[] = array(drupal_render($form['name']), array('data' => drupal_render($form['submit']), 'colspan' => 2));
$output = drupal_render($form);
$output = drupal_render_children($form);
$output .= theme('table', $header, $rows);
return $output;
......@@ -826,7 +826,7 @@ function theme_user_filter_form($form) {
$output = '<div id="user-admin-filter">';
$output .= drupal_render($form['filters']);
$output .= '</div>';
$output .= drupal_render($form);
$output .= drupal_render_children($form);
return $output;
}
......
......@@ -753,8 +753,12 @@ function user_search($op = 'search', $keys = NULL, $skip_access_check = FALSE) {
*/
function user_elements() {
return array(
'user_profile_category' => array(),
'user_profile_item' => array(),
'user_profile_category' => array(
'#theme_wrapper' => 'user_profile_category'
),
'user_profile_item' => array(
'#theme' => 'user_profile_item'
),
);
}
......
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