You are here

public function TaxonomyDisplayAssociatedDisplayHandlerCore::displayAssociated in Taxonomy display 7

Build our output to be rendered to the user.

Overrides TaxonomyDisplayAssociatedDisplayHandler::displayAssociated

See also

TaxonomyDisplayAssociatedDisplayHandler::displayAssociated()

File

handlers/associated/core.inc, line 12

Class

TaxonomyDisplayAssociatedDisplayHandlerCore
Add a display handler that will use the Drupal core method of display.

Code

public function displayAssociated($term, $options = NULL) {
  $build = array();
  $number_nodes = intval(isset($options['associated_per_page']) ? $options['associated_per_page'] : variable_get('default_nodes_main', 10));
  if ($number_nodes === 0) {
    $number_nodes = FALSE;
  }
  if ($nids = taxonomy_select_nodes($term->tid, TRUE, $number_nodes)) {
    $nodes = node_load_multiple($nids);
    $build += node_view_multiple($nodes);
    $build['pager'] = array(
      '#theme' => 'pager',
      '#weight' => 5,
    );
  }
  elseif (isset($options['empty_text']) && !empty($options['empty_text'])) {
    $build['no_content'] = array(
      '#prefix' => '<p>',
      '#markup' => t($options['empty_text']),
      '#suffix' => '</p>',
    );
  }
  return $build;
}