0

For example:

function awd_form_alter(&$form, &$form_state, $form_id){
    dpm($form_id);
    if(substr($form_id, 0,22) == 'eck__entity__form_edit'){
        $form['actions']['submit']['#submit'][] = 'submi';
    }
}

function submi(&$form, &$form_state){
    unset($_REQUEST['destination']); // this doesn't seem to work though
    unset($form['#redirect']); // i think this doesnt do anything because $form is not a reference
    $form_state['redirect'] = '<front>';
}

Thing is, the original submit callback (eck__entity__form_submit) from ECK module has already a $form_state['redirect'] and i want to alter that with out overriding the original submit callbcak function

I got it by unsetting the original callback from the $form in my hook_form_alter, copy paste the submit callback function into my module and then change the redirect but looks hacky. I also tried commenting the 2 lines at eck.entity.inc:495 but does the same, does not respond to my $form_state[redirect]

  • Well, you can directly put the redirect code in your form_alter without adding a new submit callback – Gaurav Rajdeo May 14 '17 at 15:05
  • Did not try that, but i manged to do it by adding this unset($_GET['destination']); drupal_static_reset('drupal_get_destination'); drupal_get_destination(); to my custom submitcallback – Gianni Di Falco May 15 '17 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.