I think the title says it all. Just for clarification see the attached screenshot.

CommentFileSizeAuthor
screenshot_01.jpg220.49 KBrontec76
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rontec76’s picture

Assigned: Unassigned » rontec76
Jacine’s picture

Yeah, this is one of the most annoying things in d7. These terms should be in a list, not just a bunch of divs.

Jeff Burnz’s picture

@rontec76 - you got a patch coming for this one? Be good to resolve this.

@Jacine - we could make them lists, what you think? It does mean adding the suggestions - but I've been thinking about coming in with a late breaking patch for D7 to add suggestions per field-type to make this a hell of lot easier. I've been using...

<?php
function themename_preprocess_field(&$vars, $hook) {
  // Add specific suggestions that can override the default implementation.
  array_unshift($vars['theme_hook_suggestions'], 'field__' . $vars['element']['#field_type']);
}
?>
Jacine’s picture

@Jeff I think suggestions are a great idea. If you post up an issue let me know and I'll chime in to support.

Either way, we should definitely make this a list IMO.

Jeff Burnz’s picture

OK, I posted an issue - lets see how this fly's #784792: Field Type Template Suggestions

Jeff Burnz’s picture

oh btw, I'm doing with this with Bartik on local host already - applying the patch from the above issue and using this in template.php

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

  // Render the label, if it's not hidden.
  if (!$vars['label_hidden']) {
    $output .= '<h3>' . $vars['label'] . '</h3>';
  }

  // Render the items.
  $output .= '<ul class="taxonomy-list">';
  foreach ($vars['items'] as $delta => $item) {
    $output .= '<li>' . drupal_render($item) . '</li>';
  }
  $output .= '</ul>';

  // Render the top-level DIV.
  $output = '<div class="terms clearfix">' . $output . '</div>';

  return $output;
}
jensimmons’s picture

I'm all for overridding core output to make these be the

  • they should be. In whatever way we can.
  • joachim’s picture

    Don't reinvent the wheel -- use http://api.drupal.org/api/function/theme_links/7

    Jeff Burnz’s picture

    Umm, so your saying using theme_field to theme a field rather than theme_links is reinventing the wheel?

    Say wha?

    joachim’s picture

    In that theme_links makes you a UL of inline links.

    Jeff Burnz’s picture

    OK, I see, but really the issue cuts deeper than just a UL - its about using any markup we want in whatever field type. BTW sorry if I sounded a bit rude (now I read again) I wasn't meaning to.

    joachim’s picture

    Project: Bartik » Drupal core
    Version: 7.x-1.x-dev » 7.x-dev
    Component: User interface » taxonomy.module
    Category: task » bug

    :D

    Hmmm they're a long list on Garland too.

    I think we should move this to core, and fix it in either taxonomy module or FieldAPI rather than every theme having to do the same work.

    Jeff Burnz’s picture

    Should we mark this as a duplicate of #784792: Field Type Template Suggestions

    joachim’s picture

    Status: Active » Closed (duplicate)

    Looks like, yes

    Jeff Burnz’s picture

    OK, I'll mark this as duplicate of #784792: Field Type Template Suggestions since the other issue is really questioning this for core.

    Just to clarify something that has not been stated - if you do want field items inline you can select this in the Display Options for the field. However this is about HTML, the display options merely change the display using CSS.

    webmatter’s picture

    Thanks for the hint on the bartik function ... works great. Now terms are an ul list as they should be :)

    osopolar’s picture

    BTW: The Fences module will help you to eg. render the taxonomy terms as a list.

    mlr1980’s picture

    I'm having this same obnoxious issue on a D7 dev site I'm building with Corporate Clean. I've tried tinkering with the CSS, as well as the settings on both the Text Formatter and Taxonomy Formatter modules but for the life of me, I can't figure this out. I can either get the terms unlinked, on one line, separated by commas, or I can get them linked, on different lines with a comma in between. Does someone know of the fix for this? It's driving me nuts. Thx in advance.

    redytravis’s picture

    Issue summary: View changes

    just float the divs to the left then use jquery.

    jQuery("div.field-name-field-tags .field-items .field-item a:not(div.field-name-field-tags .field-items .field-item:last-child a)").append(", ");