function taxonomy_facets_get_term_id_from_url_alias in Taxonomy Facets 7.2
Get term id.
For a given taxonomy term name return the term id.
Parameters
integer $term: Taxonomy term name.
Return value
integer Return the term id. return null if no term with this name found.
1 call to taxonomy_facets_get_term_id_from_url_alias()
- _taxonomy_facets_get_selected_filters in ./
taxonomy_facets.module - Utility function to get filters.
File
- ./
taxonomy_facets.module, line 835 - Taxo Faceted Navigation module code.
Code
function taxonomy_facets_get_term_id_from_url_alias($term) {
$result = db_query('SELECT source FROM {url_alias} WHERE alias = :alias', array(
'alias' => $term,
));
foreach ($result as $record) {
// Record in the form taxonomy/term/no, for example taxonomy/term/21,
// so we just return 21.
$source = explode('/', $record->source);
return $source[2];
}
// If there were no records, i.e no term with this name, we return null.
return NULL;
}