You are here

function taxonomy_facets_get_nodes_based_on_intersect_of_terms in Taxonomy Facets 7.3

Same name and namespace in other branches
  1. 7.2 taxonomy_facets.module \taxonomy_facets_get_nodes_based_on_intersect_of_terms()

Get nodes tagged by given terms.

Nodes have been associated with various terms. For terms passed in the url as the argument, return all nodes that have those terms associated with them. Nodes that have *all* of the terms associated will be returned, i.e intersection of terms.

Parameters

string $text_compare: (optional) string

string $text_compare_middle: (optional) string

2 calls to taxonomy_facets_get_nodes_based_on_intersect_of_terms()
MenuTree::displayMenuItem in classes/MenuTree.php
When building menu tree we check if we want to display a menu item depending on various user preferences
taxonomy_facets_print_landing_page in ./taxonomy_facets.module
Print the page that displays list of nods when filters are applied.

File

./taxonomy_facets.module, line 450

Code

function taxonomy_facets_get_nodes_based_on_intersect_of_terms($text_compare = NULL, $text_compare_middle = NULL) {

  // Get node types used in taxo faceted filtering.
  $node_types = variable_get('taxonomy_facets_content_type_options', array());
  $nodeTypes = array();
  foreach ($node_types as $key => $value) {
    if ($value !== 0) {
      $nodeTypes[] = $value;
    }
  }

  // Get applied filters
  $tids = \taxonomyFacets\TaxoFacets::getInstance()
    ->getAppliedFilterTids();
  $nodes = taxonomy_facets_get_nodes($tids, $nodeTypes, $text_compare = NULL, $text_compare_middle = NULL);
  $arr_result = array();
  foreach ($nodes as $node) {
    $arr_result[] = $node->nid;
  }
  return $arr_result;

  /* TO DO - implement free text search in conjunction with faceted search
    if ($text_compare) {
    $wheres .= 'AND n.title LIKE \'' . $text_compare . '%\'';
    }

    if ($text_compare_middle) {
    $wheres .= 'AND n.title LIKE \'%' . $text_compare_middle . '%\'';
    }
    */
}