I have a submit handler to the user form. It redirect the user to a specific page.
use Symfony\Component\HttpFoundation\RedirectResponse as RedirectResponse;
/**
* @file
* Primary module hooks for EHESS Propositions 3 module.
*
* @DCG
* This file is no longer required in Drupal 8.
* @see https://www.drupal.org/node/2217931
*/
function ehess_propositions_3_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_form') {
foreach (array_keys($form['actions']) as $action) {
if (isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
$form['actions'][$action]['#submit'][] = '_ehess_propositions_3_user_profile_submit';
}
}
}
}
function _ehess_propositions_3_user_profile_submit($form, &$form_state) {
$response = new RedirectResponse('/admin/content/reglement/');
$response->send();
}
But the problem is that the submit handler is fired both for user update and user deletion. That block the redirection to "confirm deletion" page of user.
Is there a specific action to updating user form only and not user delete?