function xmlsitemap_taxonomy_get_node_count in XML sitemap 7.2
Same name and namespace in other branches
- 6.2 xmlsitemap_taxonomy/xmlsitemap_taxonomy.module \xmlsitemap_taxonomy_get_node_count()
Find the number of nodes that are associated with a taxonomy term.
@codingStandardsIgnoreStart
Parameters
obejct $term: A taxonomy term object.
Return value
int The number of nodes associated with the term.
File
- xmlsitemap_taxonomy/
xmlsitemap_taxonomy.module, line 240 - Main file for XML sitemap taxonomy.
Code
function xmlsitemap_taxonomy_get_node_count(stdClass $term) {
// @codingStandardsIgnoreEnd
// @todo Use db_rewrite_sql() w/ switch user.
return db_query_range("SELECT COUNT(ti.nid) FROM {taxonomy_index} ti LEFT JOIN {node n} USING (nid) WHERE ti.tid = :tid AND n.status = 1", 0, 1, array(
':tid' => $term->tid,
))
->fetchField();
}