Comments

JoeMcGuire’s picture

Title: comma seperated list » comma seperated, ordered list and unordered list
Status: Needs work » Needs review
StatusFileSize
new4.03 KB

I've extended the formatters to allow comma separated strings, ordered list and unordered list for both links and default text.

I've tried to add it in a way which is scalable for additional formatters.

xjm’s picture

Marked #303486: Display Type - List as duplicate of this issue.

xjm’s picture

xjm’s picture

Marked #759556: Display content taxonomy values inline as duplicate. If you'd like this feature, test the patch and post feedback on whether it works and meets your need.

YK85’s picture

subscribing

caschbre’s picture

I installed the patch and have started to use the link (comma separated) and so far so good. It only took me five minutes to remember to flush the cache. :-)

mpaler’s picture

patch works perfectly for me. +1 for inclusion.

JoeMcGuire’s picture

Status: Needs review » Reviewed & tested by the community

Can we get this committed to dev?

naero’s picture

Status: Reviewed & tested by the community » Needs work

Hi there, JoeMcGuire:

I want to report that this patch did not work for me. I applied the patch to the 6.x-1.x-dev module. After uploading the changed files and clearing my caches, I can see the changed "Format" select box with the new formats, however, these formats do not work:

  • Plain text (comma separated)
  • As link (comma separated)
  • Plain text (ordered list)
  • As link (ordered list)
  • Plain text (unordered list
  • As link (unordered list)

The result is an empty value.

Please let me know how I can help out further. I've modified the status of this issue to "needs work".

naero’s picture

Status: Needs work » Reviewed & tested by the community

An update: it is working now. I had to upgrade CCK to the latest version, so all is well now.

I'm changing the status back to "reviewed & tested by the community". Sorry if this held things up at all. Great job!

YK85’s picture

Yes, this works great!
+1 for commit

rhymeswithcamera’s picture

This patch/functionality is exactly what I was looking for. I have a lot of shared CCK Content Taxonomy fields, and I'm using Display Suite to lay out most of the site. Being able to *easily* apply different formats to these fields for the different build modes is awesome - e.g. label above or inline, comma-separated with or without links, lists with or without links. Great job!

+1 for commit

Annie Rothenberg’s picture

Are there plans to commit this to the module? I'd really like this functionality but applying a patch is a bit over my head.

rhymeswithcamera’s picture

I've been developing with this patched version. Some of my fields are multi-value Content Taxonomy fields with a max limit of 5 values. I render these fields as checkboxes and users are allowed to tick off 1 to 5 values. They are required fields, so they have to tick off at least one value.

When I use the field formatter on these max-5 fields, I always get 4 commas in the output - regardless of whether I have one value or 5 values.

Example: Family, Seniors,,,

Is this caused by this patch?

sethviebrock’s picture

Re: #14

Seems like there might be an issue deeper in Content Taxonomy -- deeper than I have time to explore for my particular project's launch date.

To get around this for now, I added a seemingly harmless if statement in a content_taxonomy.module patched with the patch in comment #1, adding "if( !empty($item['#item']['value']) ){...." in the following function:

function _content_taxonomy_formatter_multiple_value($element) {
  $values = array();
  $format = substr($element['#formatter'], strrpos($element['#formatter'], '_') + 1);

  $item = $element;
  foreach (element_children($element) as $key) {
    unset($item[$key]);
  }
  foreach (element_children($element) as $key) {
    $item['#item'] = $element[$key]['#item'];
    //Why would there be empty value fields? Don't know, but there are: 
    if( !empty($item['#item']['value']) ){
      $values[] = theme('content_taxonomy_formatter_' . $format, $item);
    }
  } 
   
  return $values;

}
 
rhymeswithcamera’s picture

Sorry for my delayed response. Just tested this workaround. Works great. Thanks!

mstrelan’s picture

+1 for patch in #1

Works a charm and is something that is really lacking

mstrelan’s picture

Status: Reviewed & tested by the community » Needs work

Changed my mind... if the field is empty it still shows an empty list item when using Unordered List. Feel free to set back to RTBC or commit if you can't replicate this.

mstrelan’s picture

Status: Needs work » Needs review
StatusFileSize
new4.66 KB

Update of the patch in #1 to check if the field is empty or not. PS what's up with CVS? 6.x-1.x-dev is not HEAD?

mstrelan’s picture

And here's the same patch but against CVS (6.x-1.x-dev)

kbk’s picture

Title: comma seperated, ordered list and unordered list » comma separated, ordered list and unordered list
ck9’s picture

could somebody kindly provide a patched version of the content_taxonomy file? i've tried doing it in windows manually and using cygwin, netbeans, and wingnu32, but with no success. thanks

mstrelan’s picture

OK apparently my patch above never worked because I was passing the wrong thing to content_taxonomy_content_is_empty(). Here is a re-roll.

@ck9 - patched file below

BeaPower’s picture

Any updates?

spidersilk’s picture

Just used the patch in #23 - worked great! Another vote to commit.

BeaPower’s picture

I applied the patch through ssh but saw no changes. Here is the message:

[root@ip-323 content_taxonomy]# patch -p0 < content_taxonomy_multiple_formatters_cvs_0.patch
(Stripping trailing CRs from patch.)
patching file content_taxonomy.module
Reversed (or previously applied) patch detected! Assume -R? [n] y
patch unexpectedly ends in middle of line
Hunk #4 succeeded at 247 with fuzz 1.
[root@ip-323 content_taxonomy]# patch < content_taxonomy_multiple_formatters_cvs_0.patch
(Stripping trailing CRs from patch.)
patching file content_taxonomy.module
patch unexpectedly ends in middle of line
Hunk #4 succeeded at 309 with fuzz 1.
[root@ip-3233 content_taxonomy]#

spidersilk’s picture

BeaPower - from the "patch unexpectedly ends in middle of line" part, it sounds like maybe the patch file didn't completely download or upload? Re-applying it when it was already partially applied might cause problems, so it would probably be best to just upload the fully patched file - content_taxonomy.module.txt from comment #23. Just take the .txt off the end and upload it to replace your existing content_taxonomy.module file.

mstrelan’s picture

Just used #23 on another site and it worked perfectly again, bump for commit

xjm’s picture

Status: Needs review » Reviewed & tested by the community
japanitrat’s picture

for some reason I get the the list output and after it the normal output (links/text in separate divs) without the first item. It seems to me that the formatter processes the first item as list including all items and then goes on with printing the rest of the items normally.

I got the latest version of drupal, cck and content_taxonomy

LGLC’s picture

#23 works amazingly well for me. Thanks!

3dloco’s picture

Thanks! #23 works for me too!

Anonymous’s picture

thanks for this. This issue gave me plenty of headaches today. not anymore.
#23 works great for me so far.

he0x410’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: bassie111 » he0x410
Status: Reviewed & tested by the community » Patch (to be ported)

Will apply patch #23

Melissamcewen’s picture

has this been committed?

xjm’s picture

Doesn't look like @artem.taranyuk committed it:
https://docs.google.com/present/view?id=0ARCZ5QIal5NIZGhoemJmcTJfNDljc2c...

It sounds like maybe the patch needs to be rerolled against the newer branch?

hanno’s picture

subscribe

caponey’s picture

I have been wondering about this for a long, long, time; this is great. Thank you mstrelan for the patched FILE. I have tried several times to patch modules, and fail, every single time, so when you guys give us patched files, it truly is a generous act, and very much appreciated. Just wanted to chime in with a giant thanks!

Iritscen’s picture

mstrelan, you are awesome. Thanks so much for the list feature, it's just what I needed. Now if only someone would commit this....

mstrelan’s picture

Hey no worries. I would suggest if you don't want to patch this module just try out Text Formatter. I haven't tried it on D6, but it's very useful on D7 and much more flexible as it doesn't just apply to taxonomy terms.

hockey2112’s picture

Thanks, this worked great for me!

yan’s picture

Issue summary: View changes

I don't know if this actually ever commited, but at least in the latest version for Drupal 6 is still 6.x-1.0-rc2 (from 2009-Aug-19!). Is there any hope that this feature will make it somehow into a (more or less) stable release?