Save & Edit ignores form submit handlers

Created on 11 April 2023, over 1 year ago
Updated 21 August 2023, about 1 year ago

Problem/Motivation

the save_edit button does not run the submit handlers from save and does not allow overriding/extending its save handler

Steps to reproduce

function my_module_form_alter(&$form, $form_state, $form_id) {
  if (in_array($form_id, ['node_event_edit_form', 'node_event_form'])) {
    $form['actions']['submit']['#submit'][]  = 'my_module_form_submit';
    $form['actions']['save_edit']['#submit'][]  = 'my_module_form_submit';
  }
}
/**
 * @param array $form
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *
 * @return void
 */
function my_module_form_submit(array $form, FormStateInterface $form_state) {
  Drupal::logger('my_module')->info('custom save handler');
}

The Save button runs the custom my_module_form_submit but the save_edit button does not.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: outdated

Version

1.3

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024