function taxo_faceted_navigation_print_landing_page in Taxonomy Facets 7
Print the page that filters are applied to.
When user selects the filters print the page of node teasers. Only relevant nodes are printed, i.e result set of the applied filters.
Return value
string Formatted list of teasers.
2 string references to 'taxo_faceted_navigation_print_landing_page'
- taxo_faceted_navigation_firstarg_exsists_in_menu_router in ./
taxo_faceted_navigation.admin.inc - Check the menu_router, url_alias table and see if the keyword exsits.
- taxo_faceted_navigation_menu in ./
taxo_faceted_navigation.module - Implements hook_menu().
File
- ./
taxo_faceted_navigation.module, line 789 - Taxo Faceted Navigation module code.
Code
function taxo_faceted_navigation_print_landing_page() {
$selected_filters = taxo_faceted_navigation_get_selected_filters();
// Will hold term ids.
$tids = array();
$names = '';
$filters_number = 0;
foreach ($selected_filters as $filter) {
$filters_number++;
$tids[] = $filter['tid'];
$names .= ' ' . $filter['term_name'] . ',';
}
$names = rtrim($names, ", ");
$output = array();
if ($filters_number === 0) {
NULL;
}
elseif ($filters_number === 1) {
$names = '<em>Filter:</em> ' . $names;
}
else {
$names = '<em>Filters:</em> ' . $names;
}
$output['term_heading'] = array(
'#prefix' => '<h2 >',
'#suffix' => '</h2>',
'#markup' => $names,
);
$gotohome_if_nofilters = variable_get('taxo_faceted_navigation_redirect_to_home', FALSE);
if ($filters_number == 0 && $gotohome_if_nofilters) {
// but if user specifies different page redirect to that page
if ($redirect_to_page = variable_get('taxo_faceted_navigation_redirect_to_page', FALSE)) {
drupal_goto($redirect_to_page);
}
else {
drupal_goto();
}
}
if ($nids = taxo_faceted_navigation_get_nodes_based_on_intersect_of_terms($selected_filters)) {
$nodes = node_load_multiple($nids);
$output += node_view_multiple($nodes);
$output['pager'] = array(
'#theme' => 'pager',
'#weight' => 2,
);
}
else {
$output['no_content'] = array(
'#prefix' => '<p>',
'#markup' => t('There is currently no content classified with this combination of filters. Try removing one or more filters'),
'#suffix' => '</p>',
);
}
return $output;
}