You are here

function taxonomy_facets_print_landing_page in Taxonomy Facets 7.2

Same name and namespace in other branches
  1. 7.3 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
Taxo Faceted Navigation module code.

Code

function taxonomy_facets_print_landing_page() {

  // get array of applied filters from the url
  $selected_filters = taxonomy_facets_get_selected_filters();

  // Create a string of applied filters, to be displayed on the top of the page
  // also count number of filters
  // $tids = array();
  $names = '';
  $filters_number = 0;
  foreach ($selected_filters as $filter) {
    $filters_number++;

    // $tids[] = $filter['tid'];
    $names .= ' ' . $filter['term_name'] . ',';
  }

  // Somtimes 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($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;
}