When I enter a term, the tag is highlighted in cloud, but when I enter the node, the hightlight is lost.

How can I make the term (in my case multiple terms) highlighted?

Comments

enboig created an issue. See original summary.

enboig’s picture

I have modified the module to add CSS to active tags:

/**
 * Display Single Tag with Style
 *
 */
function tagclouds_display_term_link_weight($name, $tid, $weight, $description) {
  if ($term = taxonomy_term_load($tid)) {
    switch (arg(0)) {
      case 'node':
        if (is_numeric(arg(1))) {
          $entity_type = 'node';
          $entities = entity_load($entity_type, array(arg(1)));
          $entity = reset($entities);
        }
        break;
      //TODO other entity types support
    }
    $tids=array();
    if (is_object($entity)) {
      // get all fields for the given node type
      $fields = field_info_instances('node', $entity->type);
      foreach ($fields as $fieldname => $info) {
        // check if fields are taxonomy terms
        if ($info['widget']['module'] == 'taxonomy') {
          // if they are, load all term names and tids for given field
          foreach (field_get_items('node', $entity, $fieldname) as $field) {
            $tids[]=$field['tid'];
          }
        }
      }
    }
    $uri = entity_uri('taxonomy_term', $term);
    $uri['options']['attributes']['class'][] = 'tagclouds';
    $uri['options']['attributes']['class'][] = 'level' . $weight;
    $uri['options']['attributes']['title'] = $description;
    return "<span class='tagclouds-term".( in_array($tid, $tids) ? " active-tagclouds": '')."'>" . l($name, $uri['path'], $uri['options']) . "</span>\n";
  }
}

I have copied the code to get terms from taxonomy_menu_tails. May I commit a patch?

enboig’s picture

joseph.olstad’s picture

Status: Active » Needs review
chris matthews’s picture

Version: 7.x-1.11 » 7.x-1.x-dev
Category: Support request » Feature request
Status: Needs review » Active
Issue tags: -tag, -menu

@enboig, this seems like a nice idea for improvement. Since there is no patch file to review/test I'm setting the issue status back to active for now. Are you able to upload a patch file based on your code in #2?

grask0’s picture

Status: Active » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.