You are here

function featured_content_get_search_nids in Featured Content 6

Same name and namespace in other branches
  1. 6.2 featured_content.module \featured_content_get_search_nids()
  2. 7.2 featured_content.module \featured_content_get_search_nids()
  3. 7 featured_content.module \featured_content_get_search_nids()

Get search result node nids. Uses the title of the current node page to get the search results.

1 call to featured_content_get_search_nids()
featured_content_view in ./featured_content.module
Provides 'view' info for hook_block().

File

./featured_content.module, line 817
Featured Content module for created related & featured content blocks.

Code

function featured_content_get_search_nids($data) {

  // only works if on a node page
  $nids = array();
  $node = _featured_content_load_node();
  if (!empty($node)) {

    // get nids associated with node title using search
    $num_words = (int) $data['num_words_in_title'];
    $keyword_search_string = featured_content_get_search_string($node, $num_words);
    $results = do_search($keyword_search_string, 'node');
    foreach ($results as $result) {
      $nids[$result->sid] = $result->sid;
    }

    // unless configured, exclude current node page
    if (!$data['include_node']) {
      unset($nids[arg(1)]);
    }
  }
  return $nids;
}