Skip to content

Commit

Permalink
Apply patch 12 from D7 issue 1291042
Browse files Browse the repository at this point in the history
  • Loading branch information
yorkshire-pudding committed Mar 1, 2024
1 parent a50ea91 commit c5be221
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions save_edit.module
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,16 @@ function save_edit_form_alter(&$form, $form_state, $form_id) {
'#access' => user_access('use save and edit'),
'#value' => t($config->get('save_edit_button_value')),
'#weight' => $config->get('save_edit_button_weight'),
'#submit' => array('redirect_save_edit_submit'),
);
$form['actions']['save_edit']['#submit'] = $form['actions']['submit']['#submit'];
// Unset node submit if it's present, we'll handle that in
// redirect_save_edit_submit().
foreach ($form['actions']['save_edit']['#submit'] as $key => $value) {
if ($value == 'node_form_submit') {
unset($form['actions']['save_edit']['#submit'][$key]);
}
}
$form['actions']['save_edit']['#submit'][] = 'redirect_save_edit_submit';

// Now if we have chosen to use the auto-unpublish feature, we should
// create a Publish button to add a clear workflow.
Expand All @@ -88,8 +96,16 @@ function save_edit_form_alter(&$form, $form_state, $form_id) {
'#access' => user_access('use save and edit'),
'#value' => t($config->get('save_edit_publish_button_value')),
'#weight' => $config->get('save_edit_publish_button_weight', 7),
'#submit' => array('redirect_save_edit_submit'),
);
$form['actions']['save_edit_publish']['#submit'] = $form['actions']['submit']['#submit'];
// Unset node submit if it's present, we'll handle that in
// redirect_save_edit_submit().
foreach ($form['actions']['save_edit']['#submit'] as $key => $value) {
if ($value == 'node_form_submit') {
unset($form['actions']['save_edit']['#submit'][$key]);
}
}
$form['actions']['save_edit_publish']['#submit'][] = 'redirect_save_edit_submit';
}

if ($config->get('save_edit_hide_default_save')) {
Expand Down

0 comments on commit c5be221

Please sign in to comment.