function _taxonomy_facets_get_selected_filters in Taxonomy Facets 7.2
Utility function to get filters.
Parameters
array $terms: Array of terms
Return value
array Array of filter arrays, each filter array has all the info about a filter: tid, path alias, term name, vid.
1 call to _taxonomy_facets_get_selected_filters()
- taxonomy_facets_get_selected_filters in ./
taxonomy_facets.module - Get all selected filters from the url.
File
- ./
taxonomy_facets.module, line 372 - Taxo Faceted Navigation module code.
Code
function _taxonomy_facets_get_selected_filters($terms) {
$filters = array();
foreach ($terms as $term) {
$tid = taxonomy_facets_get_term_id_from_url_alias($term);
$filter = array();
if ($tid) {
// If url alias was not a recognised taxonomy term then
// taxonomy_facets_get_term_id_from_url_alias($term)
// function above returned NULL, so we just ignore that alias,
// will be useful if alias is node alias.
$filter['tid'] = $tid;
$filter['term_path_alias'] = $term;
$name = taxonomy_facets_get_term_name_from_id($tid);
$filter['term_name'] = $name['name'];
$filter['vid'] = $name['vid'];
// Will use below for ordering of filter, its just array of
// vids indicating which vocabularies are actually selected.
$filters_vids[] = $name['vid'];
$filters[] = $filter;
}
}
return $filters;
}