Been researching, experimenting, and posting this one to death! In IRC, you suggested that I post in AT issue queue.

ISSUE:
Need taxonomy term description on hover of term, for node add/edit form and node display. Ideally, description embedded in TITLE attribute of container tag, rather than achor/link for more flexibility. Preprocess function????? Don't know the syntax to use. See sample code below:

USE CASE:
Many custom content types, with many custom fields -- taxonomy term reference field types.
User needs to see full description of term to best complete 'questionnaire'.
An essential UI/UX feature!!! (Why does this not exist anywhere by default?)
This functionality would improve many contrib modules instantly, without any modification to those modules code. E.g., core, Better Exposed Filters

Here is a function that you added to theme.php for Bartik. I have added TITLE attribute placeholder code, where I want the term description:

function bartik_field__taxonomy_term_reference($variables) {
  $output = '';

  // Render the label, if it's not hidden.
  if (!$variables['label_hidden']) {
    $output .= '<h3 class="field-label">' . $variables['label'] . ': </h3>';
  }

  // Render the items.
  $output .= ($variables['element']['#label_display'] == 'inline') ? '<ul class="links inline">' : '<ul class="links">';
  foreach ($variables['items'] as $delta => $item) {
    $output .= '<li title="Taxonomy Term Description" class="taxonomy-term-reference-' . $delta . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</li>';
  }
  $output .= '</ul>';

  // Render the top-level DIV.
  $output = '<div class="' . $variables['classes'] . (!in_array('clearfix', $variables['classes_array']) ? ' clearfix' : '') . '">' . $output . '</div>';

  return $output;
}

NOTE: I also tried creating a field--taxonomy-term-reference.tpl.php and field--taxonomy-term-reference--edit.tpl.php (???) file to accomplish this. The placeholder text did show for the former, but not the latter. But, again, in any case, I didn't have the PHP code write to display term description.

Would greatly appreciate the code help with this. When successful, I will post this solution for the benefit of others.

Comments

greta_drupal’s picture

P.S. -- In my Use Case, these taxonomy term reference field values are checkboxes & radio buttons, on the node form (and Better Exposed Filters). In some cases, the label is displayed, in others not. I do want the term description to show on hover in all cases.

Example:

LODGING TYPE [vocab]
[ ] Hotel
[ ] Motel
[ ] Resort
[ ] Campground
[ ] B&B
...

P.S.S. -- You used field--taxonomy-term-reference.tpl.php in previous version of Sky, to manipulate taxonomy term references.

Jeff Burnz’s picture

You can override the field--taxonomy-term-reference.tpl.php file in Adaptivetheme in your sub-theme and print the description from the data structure.

Note to anyone using 7.x-3.x, in this version the template was removed and instead uses a function, which you can find in theme.inc should you need to copy it.

Do you have your site online for a quick peak?

greta_drupal’s picture

Jeff, while I appreciate that you responded, it doesn't appear that you read my whole, thoughtful post. You were my last hope after stumping so many others. I give up.

Jeff Burnz’s picture

Status: Active » Closed (won't fix)

LOL, OK, whatever man.

MrPhilbert’s picture

Greta,
I've been trying to figure this out for a while to no avail.

greta_drupal’s picture

I have a function to show this on the node display. Contact me directly if you want to know more or brainstorm about a node edit form solution.

gro11ver’s picture

greta_drupal, this is functionality I have been searching for. I was beginning to think I was the only one that needed this until I came across your post. Specifically, I would like to get this working on the node edit page too. I have not come across any information that explains the how-to. Have you found a solution yet?

adretedotse’s picture

In views - I just added two separate (excluded) fields (same twice), containing the taxonomy term field as text - and the other as a link.

Then I added a global custom text field and put the fields where I needed them.

Example: <a span class="whatever" title="[taxonomy_vocabulary_2_1]">[taxonomy_vocabulary_2]</a>

[taxonomy_vocabulary_2_1] beeing the text-field version.

[taxonomy_vocabulary_2] beeing the actual link.

Hope it sparks some ideas about fixing this issue.