Commit 922a46d2 authored by Dries's avatar Dries

- Patch #34920 by Morbus/webchick/tangent: fixed order of form fields.

parent 5accfa08
......@@ -247,7 +247,7 @@ function book_validate($node) {
*/
function book_form(&$node) {
$form['parent'] = array(
'#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -15,
'#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -4,
'#description' => t('The parent that this page belongs in. Note that pages whose parent is <top-level> are regarded as independent, top-level books.')
);
......@@ -258,16 +258,13 @@ function book_form(&$node) {
$form['format'] = filter_form($node->format);
$form['log'] = array(
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log, '#weight' => 18,
'#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
if (user_access('administer nodes')) {
$form['weight'] = array(
'#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => -14,
'#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => 5,
'#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
}
......
......@@ -247,7 +247,7 @@ function book_validate($node) {
*/
function book_form(&$node) {
$form['parent'] = array(
'#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -15,
'#type' => 'select', '#title' => t('Parent'), '#default_value' => ($node->parent ? $node->parent : arg(4)), '#options' => book_toc($node->nid), '#weight' => -4,
'#description' => t('The parent that this page belongs in. Note that pages whose parent is <top-level> are regarded as independent, top-level books.')
);
......@@ -258,16 +258,13 @@ function book_form(&$node) {
$form['format'] = filter_form($node->format);
$form['log'] = array(
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log, '#weight' => 18,
'#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
if (user_access('administer nodes')) {
$form['weight'] = array(
'#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => -14,
'#type' => 'weight', '#title' => t('Weight'), '#default_value' => $node->weight, '#delta' => 15, '#weight' => 5,
'#description' => t('Pages at a given level are ordered first by weight and then by title.')
);
}
......
......@@ -241,9 +241,10 @@ function comment_form_alter($form_id, &$form) {
$selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
$form['user_comments'] = array(
'#type' => 'fieldset',
'#title' => t('User Comments'),
'#title' => t('User comments'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 30,
);
$form['user_comments']['comment'] = array(
'#type' => 'radios',
......
......@@ -241,9 +241,10 @@ function comment_form_alter($form_id, &$form) {
$selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
$form['user_comments'] = array(
'#type' => 'fieldset',
'#title' => t('User Comments'),
'#title' => t('User comments'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 30,
);
$form['user_comments']['comment'] = array(
'#type' => 'radios',
......
......@@ -750,7 +750,7 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
* @return
* HTML for the form element.
*/
function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = -16, $parents = array('format')) {
function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = 0, $parents = array('format')) {
if ($value == FILTER_FORMAT_DEFAULT) {
$value = variable_get('filter_default_format', 1);
}
......
......@@ -750,7 +750,7 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
* @return
* HTML for the form element.
*/
function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = -16, $parents = array('format')) {
function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = 0, $parents = array('format')) {
if ($value == FILTER_FORMAT_DEFAULT) {
$value = variable_get('filter_default_format', 1);
}
......
......@@ -658,8 +658,9 @@ function menu_form_alter($form_id, &$form) {
'#type' => 'fieldset',
'#title' => t('Menu settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#collapsed' => empty($item['title']),
'#tree' => TRUE,
'#weight' => 30,
);
$form['menu']['title'] = array(
......
......@@ -658,8 +658,9 @@ function menu_form_alter($form_id, &$form) {
'#type' => 'fieldset',
'#title' => t('Menu settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#collapsed' => empty($item['title']),
'#tree' => TRUE,
'#weight' => 30,
);
$form['menu']['title'] = array(
......
......@@ -1614,10 +1614,10 @@ function node_form($node) {
// Get the node-specific bits.
$form = array_merge($form, node_invoke($node, 'form'));
if (!isset($form['title']['#weight'])) {
$form['title']['#weight'] = -18;
$form['title']['#weight'] = -5;
}
if (!isset($form['body']['#weight'])) {
$form['body']['#weight'] = -17;
$form['body']['#weight'] = 0;
}
// If this is a new node, fill in the default values.
......@@ -1640,13 +1640,13 @@ function node_form($node) {
if (user_access('administer nodes')) {
// Node author information
$form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5);
$form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 20);
$form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#required' => TRUE, '#default_value' => $node->name, '#weight' => -1);
$form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date);
// Node options for administrators
$form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5);
$form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25);
$form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status);
$form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => $node->moderate);
$form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote);
......@@ -1663,11 +1663,10 @@ function node_form($node) {
}
// Add the buttons.
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 19);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 45);
if ($node->nid && node_access('delete', $node)) {
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 21);
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
}
if ($op == t('Preview')) {
......
......@@ -1614,10 +1614,10 @@ function node_form($node) {
// Get the node-specific bits.
$form = array_merge($form, node_invoke($node, 'form'));
if (!isset($form['title']['#weight'])) {
$form['title']['#weight'] = -18;
$form['title']['#weight'] = -5;
}
if (!isset($form['body']['#weight'])) {
$form['body']['#weight'] = -17;
$form['body']['#weight'] = 0;
}
// If this is a new node, fill in the default values.
......@@ -1640,13 +1640,13 @@ function node_form($node) {
if (user_access('administer nodes')) {
// Node author information
$form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5);
$form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 20);
$form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#required' => TRUE, '#default_value' => $node->name, '#weight' => -1);
$form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date);
// Node options for administrators
$form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5);
$form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25);
$form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status);
$form['options']['moderate'] = array('#type' => 'checkbox', '#title' => t('In moderation queue'), '#default_value' => $node->moderate);
$form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote);
......@@ -1663,11 +1663,10 @@ function node_form($node) {
}
// Add the buttons.
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 19);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 45);
if ($node->nid && node_access('delete', $node)) {
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 21);
$form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 50);
}
if ($op == t('Preview')) {
......
......@@ -99,10 +99,7 @@ function page_form(&$node) {
$form['format'] = filter_form($node->format);
$form['log'] = array(
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log,
'#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
......
......@@ -99,10 +99,7 @@ function page_form(&$node) {
$form['format'] = filter_form($node->format);
$form['log'] = array(
'#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE
);
$form['log']['message'] = array(
'#type' => 'textarea', '#default_value' => $node->log,
'#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5,
'#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
......
......@@ -225,7 +225,8 @@ function path_form_alter($form_id, &$form) {
'#type' => 'fieldset',
'#title' => t('URL path settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#collapsed' => empty($path),
'#weight' => 30,
);
$form['path']['path'] = array(
'#type' => 'textfield',
......
......@@ -225,7 +225,8 @@ function path_form_alter($form_id, &$form) {
'#type' => 'fieldset',
'#title' => t('URL path settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#collapsed' => empty($path),
'#weight' => 30,
);
$form['path']['path'] = array(
'#type' => 'textfield',
......
......@@ -91,10 +91,6 @@ function story_form(&$node) {
$form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
$form['format'] = filter_form($node->format);
$form['log'] = array('#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['log']['message'] = array('#type' => 'textarea', '#default_value' => $node->log, '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
}
......
......@@ -91,10 +91,6 @@ function story_form(&$node) {
$form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
$form['format'] = filter_form($node->format);
$form['log'] = array('#type' => 'fieldset', '#title' => t('Log message'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['log']['message'] = array('#type' => 'textarea', '#default_value' => $node->log, '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.')
);
return $form;
}
......
......@@ -131,7 +131,7 @@ function taxonomy_form_vocabulary($edit = array()) {
$extra = module_invoke_all('taxonomy', 'form', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
......@@ -242,7 +242,7 @@ function taxonomy_form_term($edit = array()) {
$extra = module_invoke_all('taxonomy', 'term', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
......@@ -532,13 +532,12 @@ function taxonomy_form_alter($form_id, &$form) {
}
else {
$ntterms = isset($node->taxonomy) ? $terms : array_keys($terms);
$form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
}
}
if (isset($form['taxonomy'])) {
$form['taxonomy']['#tree'] = TRUE;
$form['taxonomy']['#weight'] = -15;
$form['taxonomy']['#weight'] = $vocabulary->weight;
}
}
}
......
......@@ -131,7 +131,7 @@ function taxonomy_form_vocabulary($edit = array()) {
$extra = module_invoke_all('taxonomy', 'form', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
......@@ -242,7 +242,7 @@ function taxonomy_form_term($edit = array()) {
$extra = module_invoke_all('taxonomy', 'term', 'vocabulary');
if (is_array($extra)) {
foreach ($extra as $key => $element) {
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $nodeapi[$key]['#weight'] : -18;
$extra[$key]['#weight'] = isset($extra[$key]['#weight']) ? $extra[$key]['#weight'] : -18;
}
$form = array_merge($form, $extra);
}
......@@ -532,13 +532,12 @@ function taxonomy_form_alter($form_id, &$form) {
}
else {
$ntterms = isset($node->taxonomy) ? $terms : array_keys($terms);
$form['taxonomy'][$vocabulary->vid] = taxonomy_form($vocabulary->vid, $ntterms, $help, 'taxonomy');
}
}
if (isset($form['taxonomy'])) {
$form['taxonomy']['#tree'] = TRUE;
$form['taxonomy']['#weight'] = -15;
$form['taxonomy']['#weight'] = $vocabulary->weight;
}
}
}
......
......@@ -172,6 +172,7 @@ function upload_form_alter($form_id, &$form) {
'#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
'#prefix' => '<div class="attachments">',
'#suffix' => '</div>',
'#weight' => 30,
);
$form['attachments'] += _upload_form($node);
$form['#attributes'] = array('enctype' => 'multipart/form-data');
......
......@@ -172,6 +172,7 @@ function upload_form_alter($form_id, &$form) {
'#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'),
'#prefix' => '<div class="attachments">',
'#suffix' => '</div>',
'#weight' => 30,
);
$form['attachments'] += _upload_form($node);
$form['#attributes'] = array('enctype' => 'multipart/form-data');
......
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