0

I'm looking for a hook function to interact with the buttons "Save" and "Reset to alphabetical" on taxonomy term hierarchy. Does anyone know how to override this functionality?

1

with hook_form_FORM_ID_alter you can add extra function to trigger on submit.here is a simple example for you :

/**
 * Impelement hoo_form_FORM_ID_alter
 * @param array $form
 * @param type $form_state
 * @param type $form_id
 */
function MODULENAME_form_taxonomy_overview_terms_alter(&$form, $form_state, $form_id) {
    $form['#submit'][] = 'my_news_submit';
}

function my_news_submit($form, &$form_state) {
    if ($form_state['triggering_element']['#value'] == t('Reset to alphabetical')) { // check if reset button submited or not
        drupal_set_message('RESET CALLED');
        // ADD YOUR EXTRA WORKS HERE FOR RESET 
    } else { // act on "save" button submited
        drupal_set_message('SAVED CALLED');
       // ADD YOUR EXTRA WORKS HERE FOR SUBMIT
    }
}
2
  • thank you, I don't know how I could forgot about form alter function
    – David
    Jun 13 '14 at 12:17
  • Your welcome ! ;) Jun 13 '14 at 12:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.