function taxo_faceted_navigation_get_term_id_from_url_alias in Taxonomy Facets 7
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 taxo_faceted_navigation_get_term_id_from_url_alias()
- _taxo_faceted_navigation_get_selected_filters in ./
taxo_faceted_navigation.module - Utility function to get filters.
File
- ./
taxo_faceted_navigation.module, line 728 - Taxo Faceted Navigation module code.
Code
function taxo_faceted_navigation_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;
}