function taxonomy_facets_print_landing_page in Taxonomy Facets 7.3
Same name and namespace in other branches
- 7.2 taxonomy_facets.module \taxonomy_facets_print_landing_page()
Print the page that displays list of nods when filters are applied.
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 'taxonomy_facets_print_landing_page'
- taxonomy_facets_firstarg_exsists_in_menu_router in ./
taxonomy_facets.inc - Check the menu_router, url_alias table and see if the keyword exsits.
- taxonomy_facets_menu in ./
taxonomy_facets.module - Implements hook_menu().
File
- ./
taxonomy_facets.module, line 270
Code
function taxonomy_facets_print_landing_page() {
$selected_filters = \taxonomyFacets\TaxoFacets::getInstance()
->getAppliedFilters();
// Create a string of applied filters, to be displayed on the top of the page
// also count number of filters.
$names = '';
$filters_number = 0;
if ($selected_filters) {
foreach ($selected_filters as $filter) {
$filters_number++;
$names .= ' ' . $filter->name . ',';
}
}
// Sometimes if there are no filters on the site, the site admin wants to redirect to
// a specific page, or to home page, this is setting in admin page
redirect_if_no_filters($filters_number);
$names = rtrim($names, ", ");
$output = array();
$output['term_heading'] = array(
'#prefix' => '<h2>',
'#suffix' => '</h2>',
'#markup' => taxonomy_facets_print_names_string($filters_number, $names),
);
// Get all node id's of the nodes that belong to categories that are applied
// as filters.
if ($nids = taxonomy_facets_get_nodes_based_on_intersect_of_terms()) {
$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;
}