[drupal-devel] [feature] Add Folksonomy, or "Free Tagging", to Taxonomy

Bèr Kessels drupal-devel at drupal.org
Thu Mar 31 21:23:52 UTC 2005

Issue status update for http://drupal.org/node/19697

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Morbus Iff
 Reported by:  Morbus Iff
 Updated by:   Bèr Kessels
 Status:       patch

Cris's ideas are great, but should IMO not be confused with this
folksonomy isseu.
Can we not focus on getting folksonomy in, be it with a
less-then-perfect-UI, and then open a new issue to improve the UI of

Bèr Kessels

Previous comments:

March 30, 2005 - 16:16 : Morbus Iff

Attachment: http://drupal.org/files/issues/taxonomy_all.patch (19.53 KB)

This patch adds folksonomy support to Drupal (named internally as "Free
tagging"). In a nutshell, the core difference is the input method:
unlike normal taxonomies which are administratively controlled, a "free
tagging" vocabulary allows tag creation when the node is submitted. It
does this through an text input box, as opposed to a dropdown or
selectbox. This patch:

Removes the useless "Preview form" of a vocabulary.
Alters the vocabulary table to include a new "tags" column.
Adds a new "Free tagging" preference on vocabulary creation/editing.
Modifies the vocabulary overview to support pagers for free tagging

The new code integrates tightly with the existing taxonomy code. The
only additional processing occurs on node save and edit, where we parse
through the tags associated with a node. All other display (and thus,
code) remains the same. The following screenshots illustrate the
changes, integration, and workflow:

Create/edit vocabulary screen. [1]
Create/edit a node. [2]
Result of previous screen. [3]
The new admin/taxonomy. [4]
Clicking on \"view terms\". [5]

These patches were made during the exploration and customization of
Drupal by http://www.NHPR.org. In loving support of open source
software, http://www.NHPR.org will continue to contribute patches they
feel the community will benefit from. Questions about this patch should
be directed to morbus at disobey.com.
[1] http://disobey.com/detergent/2005/drupal_folkdef.jpg
[2] http://disobey.com/detergent/2005/drupal_folknodeedit.jpg
[3] http://disobey.com/detergent/2005/drupal_folknodesubmit.jpg
[4] http://disobey.com/detergent/2005/drupal_folkpager1.jpg
[5] http://disobey.com/detergent/2005/drupal_folkpager2.jpg


March 30, 2005 - 16:38 : Morbus Iff

Attachment: http://drupal.org/files/issues/taxonomy_all_0.patch (19.52 KB)

Updated patch to fix some errors in the update.inc change.


March 31, 2005 - 16:27 : Morbus Iff

Attachment: http://drupal.org/files/issues/taxonomy_all_1.patch (19.54 KB)

New patch for check_plain and HEAD. Also removed the term indent under
vocabularies - there was an extra-space issue in regards to
_taxonomy_depth, and I felt it was better to just remove the
(non-standard, non-semantic) indent I originally added during the move
to tablular display.


March 31, 2005 - 19:19 : Anonymous

A big +1 from me! This patch is going to be *extremely* useful for
modules like "image" that involve frequent creation of new taxonomy

I've been testing this patch extensively for a couple of days. I love
the fact that it is totally non-intrusive onto existing sites if the
admin doesn't want to use it when creating vocabularies, and that the
free-tagged terms become "ordinary terms" in the database structure,
with no special-case table.

Morbus Iff has done a great job of adding a powerful feature without
breaking anything, as far as I can tell.

I can see lots of ways in which this can evolve in the future, such as
more fine-grained security so that some users can add a given node type
without being able to add new free-tagged terms (i.e., that class of
users would have to pick from existing terms only, even if the
vocabulary allows higher-privileged users to add free terms). I can
also see a place for user-owned free-tag vocabularies that are
dedicated to their personal image albums. But these features could be
added in a future release and still be backward-compatible with what
Morbus has done now. That being the case, I suggest that this patch be
accepted into core.


March 31, 2005 - 19:20 : syscrusher

Comment #3 was from me (syscrusher). Sorry I forgot to login first.


March 31, 2005 - 21:12 : Dries

I'll commit this patch to core as soon CVS HEAD is opened up for
development.  For now, I'm awaiting feedback from the usability folks. 
I'm also left wondering how this would affect taxonomy-based permissions
-- I don't think that should be a problem but it is somewhat
I haven't tested the patch yet, but I glanced at the code quickly:
1. Don't use the word 'node' in user output.  Use 'post'.
2. The words 'term' and 'tags' are both used in user output.  This
might be confusing, but I don't see an easy way around it. The way it
is used makes sense, so it might be a non-issue. 
3. Some extra documentation might be in order.  The explanation of
'free tagging' is quite technical.  For example, I don't understand the
following bit: "Allows the creation of a vocabulary during content
creation, as well as through the normal administrative means.".  I'd
rather see it explain the difference/advantage/drawbacks to help me
decide whether to enable 'free tagging' or not.  Make the documentation
more task-minded.
4. I don't like the way you manipulate the pager's global variables. 
The paging code is a bit of a hack, it seems.
5. Spacing: we write 'foreach (' not 'foreach('.
6. We usually write code comments above the code, not after the code on
the same line.  This is really minor as I'm sure we don't do this
consistently.  Some code comments are rather cryptic and didn't help me
much.  Maybe give your code comments some love.
That's all for now.


March 31, 2005 - 21:19 : FactoryJoe at civicspacelabs.org

Attachment: http://drupal.org/files/issues/drupal_folkdef.png (21.7 KB)

In setting up the folksonomy, you present far too many options to the
user. I tried to cut these extraneous options out but then decided to
redo the whole Vocabulary creation workflow. :)
Go figure.


March 31, 2005 - 21:27 : Morbus Iff

I'll address what I can. A new patch will be forthcoming.
#2: I agree - I previously wanted to keep everything as "term", and
spent a good bit of time on #drupal getting jbond (who has since
disappeared from all discussion) to agree that "term == tag" and the
only difference between the two was their method of input. Eventually,
I felt that "tag" was not only a "term" (and term), but also an action.
I'm not "terming a node", but I'm "tagging it", which is a common sorta
phrase in other folksonomy implementations. Thus, the mixing of the
#4: Yeah, I know it's a hack. I had a comment in there (since removed
due to moshe's suggestion) that I knew it was a hack, and that
integrating with the existing pager code would be uber-difficult based
on hierarchies and the recursive nature of the taxonomy_get_tree.
#6: Heh, heh. Boy oh boy. Wrong thing to say. I often find myself
overdoing it on comments (for example [6]), and the patch as is was a
concentrated effort to /reduce/ the amount of comments I had originally
put in there (see also [7]). I'll take another look at 'em.
[7] http://lists.drupal.org/archives/drupal-devel/2005-03/msg01010.html


March 31, 2005 - 21:36 : Morbus Iff

Regarding #7, it appears factoryjoe wants a far grander rewrite of the
taxonomy UI than this patch purports to do.


March 31, 2005 - 21:59 : Dries

If you can take on such rewrite (or parts thereof) based on Chris'
suggestions, by all means.  
Depending on the required UI changes, such overhaul might automagically
deal with the pager implementation issues (if the pagers get nuked that


March 31, 2005 - 22:19 : Morbus Iff

Not in this patch. His plans are for 4.7, and include wizards, removing
most all of the checkboxes on that page, and so on and so forth.
Likewise, he's only about 30% of the way there (per #drupal) in his UI
mockups, so not to be considered with this folksonomy patch at all.


March 31, 2005 - 22:22 : Morbus Iff

(Er.. which isn't to say that I think this folksonomy patch is for 4.6 -
I know 4.7 will be its earliest release. But, he's just not ready with
the workflow in his head yet for me to address any of his issues. And,
based on discussion in #drupal, I'm not sure /I/ want to be the one
implementing the changes, much less agreeing with them, he has planned
[g]). No offense to him, of course - he's (admittedly) too early in his
thinking to take on all affronts.)

More information about the drupal-devel mailing list