The function taxonomy_navigator_is_term_active() as it is currently
written results in calls to taxonomy_node_get_terms_by_vocabulary($nid, $vid)
for every taxonomy term in a given block in a given vocabulary as called
in taxonomy_navigator_block_content($vid);

This code:

  if (arg(0) == 'node' && is_numeric(arg(1))){
    $nid = arg(1);
    $terms = taxonomy_node_get_terms_by_vocabulary($nid, $vid);
    if (key_exists($tid, $terms)) {
      return TRUE;
    }
  }

results in calls to taxonomy_node_get_terms_by_vocabulary() for
each term in a given vocab when viewing a node. The call only
needs to be made once per node $nid per vocab $vid.

The attached patch adds a static cache to run this query only
once.

You can explore this issue by running the query log of devel module
with a taxonomy_navigator block for a vocabulary with many terms.

CommentFileSizeAuthor
taxonomy_navigator.module.patch1.19 KBjaydub

Comments

nestor.mata’s picture

Status: Needs review » Fixed

Thanks jaydub,

This patch was implemented in version 5.x-1.2.

Best regards,
Nestor

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.