Is there any way to prevent deleting a taxonomy term if it used in any node ?
I have a Taxonomy
that is used in Field Collection
in my Content Type
, I want to warn/prevent deletion of any Term
in that Taxonomy
if it is used in any node.
I checked taxonomy_term_confirm_delete
it is where the confirmation message is formed,
I read from some posts about using
db_query("SELECT COUNT(nid) FROM {taxonomy_index} WHERE tid = :aid", array(':aid' => $tid) )->fetchField()
to get the number of nodes a term is used in but this is not working in my case -maybe because the taxonomy is in field collection ?
field_data_field_term_reference
table for that entity's term reference field instead.