Description (copied from project page)

"Taxonomy term color is a module which allows you to add colors to terms.

WHY DO I NEED THIS?

Some websites want to seperate their content into different categories and
want to have a color for each category. This is possible with taxonomy term color

INSTALLATION AND CONFIGURATION:

- Put this module in sites/*/modules
- Enable it under admin/build/modules
- Tick the checkbox "Assign term colors" for the vocabularies whose terms should get a color.
- Now you can enter the color on the term edit page

Little feature: If you have the colorpicker module installed you can choose a color easily with a colorpicker.

HOW CAN I GET THE COLOR OF A TERM?

This module provides a function which returns the color of a term:

_taxonomy_term_color_term_color($term_id)"

Project Page

http://drupal.org/sandbox/yan_nick/1330800

Repository

git clone --branch master http://git.drupal.org/sandbox/yan_nick/1330800.git

Versions

Drupal 6.x

Comments

doitDave’s picture

Status: Needs review » Needs work

I just tested your module with D6/Windows/PHP5/My5. I activated the module, checked "assign colors" on a vocabulary page. But, there is no additional option in the terms anywhere!

Sorry, I did not look close enough at the first time. But now that I found the input field and added the value #f00 for an existing term, a database warning occured:

user warning: Duplicate entry '9' for key 'PRIMARY' query: INSERT INTO term_color (tid, vid, color) VALUES (9, 2, '#f00') in X:\drupal-6.22\includes\common.inc on line 3538.

Also, the color is not even being saved. Even when leaving the color field empty, saving throws this error. When setting a color whilst adding a new term, there is no such error.

Seems like you always save data into term_color, even when there is nothing to save. So either you would need to check for existing keys on saving (update syntax) or you should only insert when a value is given.

yannickoo’s picture

So I fixed that, can you review it?

doitDave’s picture

Hi yan_nick,

first a quick review:

  • Trying to add a term does not show up the color field anymore.
  • Saving a term fails fatally with Fatal error: Call to undefined function dsm() in \\192.168.1.100\server\test\drupal-6.22\sites\all\modules\1330800-9973f80\taxonomy_term_color.module on line 41
  • You are working on the master branch, see http://drupal.org/node/1127732 and http://drupal.org/node/1015226 and http://drupal.org/node/1066342 for details.
  • Coder set to "minor" reports: Line 50: Use an indent of 2 spaces, with no tabs
  • Use doxygene comments for all your files and functions. See http://drupal.org/node/1354 for details.

Then a question I should have already asked in my last comment: What exactly is the benefit from defining a color? On first sight I did not find any theming or output function applying the color (and testing it now was not possible, see above). You should probably also clarify this in the module description as well as in the README file.

yannickoo’s picture

Thanks for your review doitDave,

I think you forgot to tick the box "Assign term colors" on the vocabulary settings page :)

I created a new branch so the new repository is:

git clone --branch 6.x-1.0 http://git.drupal.org/sandbox/yan_nick/1330800.git

  • I installed the module with a fresh Drupal install and I can see the field and if the colorpicker module is enabled I also can see a colorpicker input field.
  • I removed dsm() (was from the debugging stuff)
  • I added some lines to the README.txt file
yannickoo’s picture

Issue summary: View changes

Adding h3 tags

yannickoo’s picture

Issue summary: View changes

Updated the description

doitDave’s picture

Hi yan_nick,

functionality now seems as expected. But you should take one more close look at the commenting standards as linked above:

  • Ideally document any function and also describe parameters and return values.
  • Don't leave a blank line between comments and function header.

Take some time to read into the coding standards and do this properly as anybody hooking into your module at a later time or supporting you with patches oder maintenance will highly appreciate well documented code. Also, it is recommended to empty the master branch (see above).

yannickoo’s picture

Okay, I added more comments.

klausi’s picture

Status: Needs work » Closed (duplicate)

Please only submit one project application, we will review #1341360: [D6] Gallery link. Marking this one as duplicate.

yannickoo’s picture

I can set the status to "needs review" when gallery link is reviewed or?

klausi’s picture

Not necessary, we approve you only once. You will be able to promote all your projects to full projects yourself.

klausi’s picture

Issue summary: View changes

Updated the description

avpaderno’s picture

Title: Taxonomy term color » [D6] Taxonomy term color
Issue summary: View changes
Related issues: +#1341360: [D6] Gallery link