Very slick module! However, I had wanted this to show taxonomy descriptions when hovering over the taxonomy term -- both on form and display. On the form, these taxonomy terms are checkbox or radio values (result of taxonomy-type field). When I hover over the checkbox values (on form), the field instruction text is display -- tried both with "HTML Source" and "Child Element" options, and with "Apply Tipsy for form items descriptions on all Drupal forms" selected. When hovering over the taxonomy term links on display, nothing is shown.

I used custom selectors:
1. label.option
2. .field-item a

Am I missing something? Or will this not do what I had hoped?

TY!

Comments

greta_drupal’s picture

Okay, duh, I see that even if #1 and #2 worked (as configured), it wouldn't show the taxonomy description straight away. Guess that I'd have to create a custom template to embed the taxonomy term description as title. ??? Which is a big job, as I have many, very long custom content forms. So, that is double the work (form and display). Really need something automated -- especially for when those get extended from time to time.

Open to suggestions. Certainly, there must be a tooltip solution to show taxonomy term description. I have Googled it (and searched Drupal.org), but didn't find much -- other than references to people using Tipsy. Surprised this isn't standard functionality for taxonomy.

cmseasy’s picture

Thanks for the link

greta_drupal’s picture

To what do you want a link?

ram4nd’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Component: User interface » Code
Category: Support request » Feature request
Issue summary: View changes
Status: Active » Needs work
hansrossel’s picture

In combination with the term_reference_tree module, this code adds a information icon with tipsy class that shows the description of the term on the edit form. Add it to template.php of your backend theme.

/**
 * Implementation of theme_checkbox_tree_item($variables) of term reference tree module
 * This function prints a single item in the tree, followed by that item's children
 * (which may be another checkbox_tree_level).
 */
function MYTHEME_checkbox_tree_item($variables) {
  $element = $variables['element'];
	$children = element_children($element);
	$output = "";

	$sm = $element['#level_start_minimized'] ? ' term-reference-tree-collapsed' : '';

	if (is_array($children) && count($children) > 1) {
		$output .= "<div class='term-reference-tree-button'></div>";
	}
	elseif (!$element['#leaves_only']) {
		$output .= "<div class='no-term-reference-tree-button'></div>";
	}

	foreach ($children as $child) {
                // $child is the tid
		$term = taxonomy_term_load($child);
		$description = trim(strip_tags($term->description));
		if (!empty($description)) {
			// @todo: make sure you cannot click on the tooltip, test: should work like href #
                        $tooltip = l('ⓘ', '', array(
      	                                'attributes' => array(
					'fragment' => ' ',
					'external' => TRUE,
      		                        'class' => array('tipsy'),
					    'title' => $description,
				        )
			));
		}
		$output .= drupal_render($element[$child]) . $tooltip;
	}

	return $output;
}