By nicoloconte on
Hi guys,
I need to perform same operation on nodes before a taxonomy term related to them is deleted. I used hook_taxonomy() but I'm not able to collect information about nodes. Here my code:
/**
* Implementation of hook_taxonomy().
*/
function taxonomy_node_taxonomy($op, $type, $array = array()){
$term_id = array($array['tid']);
switch ($type) {
case 'term':
switch ($op) {
case 'delete':
// do something
break;
}
}
}
Am I on the right way?
Thanks a lot
Nicolo'
Comments
Hi Nicolo, take a look at
Hi Nicolo,
take a look at http://api.drupal.org/api/function/taxonomy_select_nodes/6, you will be able to get a recordset containing nid's of nodes related to term (or terms).
Best,
M
@mikispeed I'm using it but I
@mikispeed
I'm using it but I have no result. My purpose is to call a function before update the database. Is it possible?
You are right, hook_taxonomy
You are right, hook_taxonomy is called after term has been deleted from DB.
I would try modifying the taxonomy_form_term form with hook_form_alter and trying something like:
Best,
M