Skip to content
Snippets Groups Projects
Commit 259e2f5c authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#195678 by catch: standardise on Save and Preview button terminology (for...

#195678 by catch: standardise on Save and Preview button terminology (for comments) and button placement for comments and nodes, so Save is always the leftmost button, and there is no guessing to find it
parent aafd4733
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1312,17 +1312,17 @@ function comment_form(&$form_state, $edit, $title = NULL) {
$form['nid'] = array('#type' => 'value', '#value' => $edit['nid']);
$form['uid'] = array('#type' => 'value', '#value' => !empty($edit['uid']) ? $edit['uid'] : NULL);
$form['preview'] = array('#type' => 'button', '#value' => t('Preview comment'), '#weight' => 19);
$form['#token'] = 'comment'. $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : '');
// Only show post button if preview is optional or if we are in preview mode.
// We show the post button in preview mode even if there are form errors so that
// Only show save button if preview is optional or if we are in preview mode.
// We show the save button in preview mode even if there are form errors so that
// optional form elements (e.g., captcha) can be updated in preview mode.
if (!form_get_errors() && ((variable_get('comment_preview_'. $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview comment')) || ($op == t('Post comment')))) {
$form['submit'] = array('#type' => 'submit', '#value' => t('Post comment'), '#weight' => 20);
if (!form_get_errors() && ((variable_get('comment_preview_'. $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 19);
}
if ($op == t('Preview comment')) {
$form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 20);
$form['#token'] = 'comment'. $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : '');
if ($op == t('Preview')) {
$form['#after_build'] = array('comment_form_add_preview');
}
......
......@@ -225,17 +225,17 @@ function node_form(&$form_state, $node) {
// Add the buttons.
$form['buttons'] = array();
$form['buttons']['preview'] = array(
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Preview'),
'#value' => t('Save'),
'#weight' => 5,
'#submit' => array('node_form_build_preview'),
'#submit' => array('node_form_submit'),
);
$form['buttons']['submit'] = array(
$form['buttons']['preview'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#value' => t('Preview'),
'#weight' => 10,
'#submit' => array('node_form_submit'),
'#submit' => array('node_form_build_preview'),
);
if (!empty($node->nid) && node_access('delete', $node)) {
$form['buttons']['delete'] = array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment