I've added a color-picked field to a taxonomy and want to the colors associated with the different terms in a view. I was hoping to get away with just doing this through the UI, without having to modify template files, etc.

I have a couple of suggestions for improving the formatters:

1) Make the "text" formatter output without the pound-sign prefix; it's always easier to add it back in by rewriting the field. Or give an alternate formatter, for backwards compatibility.
2) Improve the css classes assigned to the colored block formatter. Right now, it provides one ID and one over-specific class for the relevant div. I can't easily select *all* the colored block elements to resize them, in fac, to select them *at all* I need to know their color ahead-of-time. Adding some more generic classes to that div would be appreciated.

For myself, in the meantime, I'm going to have to add a css rule for each colour, for now. (Unless there's a better way that doesn't require me to learn php... heh. Suggestions, or code snippets welcome!)

Thanks for this module, BTW!

C.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cogno’s picture

As an aside, I'm getting the following notice when I add the colored block to a view:

Notice: Undefined property: stdClass::$nid in jquery_colorpicker_field_formatter_view() (line 335 of /home/cogno/public_html/sites/all/modules/jquery_colorpicker/jquery_colorpicker.module).

Any troubleshooting steps to suggest?

simg’s picture

I've got (had) the same problem applying this (great) module to a taxonomy term

I've hacked a fix by inserting the following line of code before line 335.

335     if ($entity_type == 'taxonomy_term') $entity->nid = $entity->tid;
336     $element[$delta]['#markup'] = '<div id ="jquery_colorpicker_color_display_' . $entity->nid . '_' . $instance['id'] . '_' . $delta .'" class="jquery_colorpicker_color_display_' . $instance['id'] . '_' . $delta . '_' . $item['jquery_colorpicker'] . '">&nbsp;</div>';

edit: since you don't know php - I'll point out that you don't include the line numbers when you cut and paste :)

plopesc’s picture

Status: Active » Fixed

I included support for taxonomy_term entity and new classes for the formatter to make easier your theming.

Regards

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

AlcidesMorales’s picture

Category: support » bug
Status: Closed (fixed) » Needs work

Still happen the same error in case of using Commerce and ($entity_type == 'commerce_line_item')

plopesc’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc1
Status: Needs work » Needs review
FileSize
1.66 KB

Hello

You're right, I forgot to improve the entity type support.

I made some test with the patch below and worked for me.

Could you try it and give me feedback?

Thanks for your interest in the module.

Regards.

plopesc’s picture

Status: Needs review » Fixed

After some tests, the patch worked for me.

Marking as fixed.

Please, reopen if your problems persist.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.