function tft_check_term_is_deletable in Taxonomy File Tree 7.2
Same name and namespace in other branches
- 7 tft.admin.inc \tft_check_term_is_deletable()
Check if the term has no files or child terms.
Parameters
int $tid:
Return value
bool
Related topics
1 call to tft_check_term_is_deletable()
- tft_delete_term_form in includes/
tft.pages.inc - Form: delete a term.
File
- ./
tft.module, line 1169 - Hook implementations and module logic for TFT.
Code
function tft_check_term_is_deletable($tid) {
$count = (int) db_query("SELECT COUNT(tid) FROM {taxonomy_term_hierarchy} WHERE parent = :tid", array(
':tid' => $tid,
))
->fetchField();
if ($count) {
return FALSE;
}
$count = (int) db_query("SELECT COUNT({taxonomy_index}.nid) FROM {taxonomy_index}\n RIGHT JOIN {node} ON {node}.nid = {taxonomy_index}.nid\n WHERE {taxonomy_index}.tid = :tid", array(
':tid' => $tid,
))
->fetchField();
if ($count) {
return FALSE;
}
return TRUE;
}