drupal-7drupal-taxonomydrupal-hooks

Hook when an item is moved in drupal 7


I've been looking for a hook in drupal 7 that allows me to send an http request when the user moves a taxonomy term in or out of another taxonomy. For example: enter image description here

I want to be able to 'detect' when I take World War in or out of This is War.
I hope you can help me, and sorry for the ignorance.


Solution

  • For anyone trying to achieve this, I found a way to do it. Not sure if it's the only one there is, but here it goes:

    In your custom .module file, implement a hook with the following form Id

    function mymodule_form_taxonomy_overview_terms_alter(&$form, $form_state)
    

    Then, you can add a #submit element like this:

    $form['#submit'][] = 'my_custom_handler';
    

    Now, you can define my_custom_handler as follows

     function my_custom_handler($form, &$form_state)
    

    And my_custom_handler will execute every time user saves changes in the specific form. If you need to get the terms in the my_custom_handler method you could somehow mimic the code in the source taxonomy module.
    I hope someone finds this useful