Tagnode

Categories

Component ID

32905

Component name

Tagnode

Component type

module

Component security advisory coverage

not-covered

Downloads

1034

Component created

Component changed

Component body

This module is deprecated in favor of CCK's nodereference module, the node relativity module, and/or any future node relations APIs.

Permits node-to-node associations, using Drupal's taxonomy system. Facilitates 1-to-many or many-to-many relationships. For example, every event has 1 (or more) location; every music CD has 1 (or more) artist. Renders links from tagnode to taggee nodes and vice versa.

Head version of tagnode now is for Drupal 4.7

SETUP
This module requires no changes to the database to function.
To install, place a folder "tagnode" in your installation's modules folder, and place these files in it.
tagnode.module
tagnode.css

Go to administer -> modules and check on the tagnode module.

Additionally, since this module uses node titles and term names in order to tag nodes to other nodes, it seems
prudent to add an index to the term_name column. You can do so using the SQL in tagnode.mysql.
Note the tagnode module functions without this index, but it might speed things up.

OVERVIEW

This module permits node-to-node associations, using Drupal's taxonomy system. Administrators set up 1 or more node types to be tagnode types. Tagnodes can be tagged to nodes of other types by going to administer -> categories -> [this tagnode's vocabulary] -> edit vocabulary, and checking all types you wish to be taggable by this tagnode. When a taggee (i.e., a node that is tagged by a tagnode) is rendered, a link is also rendered to the tagnode(s) tagged to it.

Tagnodes facilitate 1-to-many or many-to-many relationships. For example, every event has 1 (or more) location; every music CD has 1 (or more) artist.

More example uses of this module include:
Taggee -- Tagnode(s)
event -- location, sponsor
music CD -- artist, label
meeting -- organizer, chapter
sport game -- field

Tagnodes are paired with an identically named term from a particular vocabulary. That is, a tagnode = a node of a given type + an identically named term from a given vocabulary. The module uses the node title & term name as the means of linking the 2.

How to create a tagnode relationship:

1. Create or identify the node types you need. You can use nodes of any type as the tagnode or as the taggee, but most commonly these nodes are new flexinode types. For example, create a flexinode type called 'event' as the taggee, and create a flexinode type called 'place' to be the tagnode.
2. Create a new vocabulary for tagnode (go to administer -> categories -> add vocabulary). You can (but do not need to) give it the same name as the tagnode's node type. Check the box(es) of the node types to which the tagnode should be taggable. If you wish that every taggee MUST be tagged with the tagnode, then check the box 'Required'. If you wish that more than 1 tagnode of this type can be tagged to a given node (e.g. 2 or more artists can be credited to a music CD), then check the 'Multiple select' checkbox. In our example, create a new vocabulary named 'place', and check the box next to 'event' node type.
3. Having laid the groundwork, tell the module to link the tagnode's node type and vocabulary. Go to administer -> content -> configure -> content types, and click the node type you wish to convert into a tagnode (in our example, click 'place'.) Scroll to near the bottom of the form and find the 'Tagnode' configuration option. In the dropdown menu, select the vocabulary which defines the tagnode (in our example, select 'place'). Submit the form.

Once a tagnode is defined, users associate a taggee with a tagnode by selecting the tagnode's name in the dropdown select box in the taggee's form.

The module does the following actions:

* When a new tagnode is created, it creates a term (in the tagnode-defining vocabulary) with the identical name.
* When a tagnode's title is updated, the module updates the corresponding term.
* When a tagnode is deleted, it deletes the term.
* When a taggee is viewed, the tagnode(s) which have been tagged to it are also viewed. A link to the tagnode is displayed as well as the teaser or body of the tagnode.
* When a taggee's form is rendered, a link is presented to create a new tagnode for each tagnode type it is categorized against.
* When a tagnode is viewed as a teaser, a link is displayed to each of the node types to which it is taggable.
* When a tagnode is viewed as a page, a list is shown for each node type, of the most recent n nodes to which this node is tagged.

At the admin -> settings -> tagnode maintenance page, you can find and fix tagnode-defining nodes and terms which are 'orphaned'. Orphaned nodes and terms can arise when nodes or terms are imported into the database, for example.

The module uses the hook_nodeapi() hook to perform its actions. Thus, it can be applied to nodes of any type. It uses no new tables. Since it uses the node title and the term name as a means to link tagnode-defining nodes to the terms, very little data is inserted into the existing tables. The names of tagnode-defining terms should not be changed in the administer -> categories section.

If you use the node_import module (or other method) to import tagnodes, be sure to go to admin -> settings -> tagnode maintenance to add the corresponding terms for the tagnodes you have imported.

The tagnode maintenance area also works well at retrofitting nodes which already exist to be tagnodes. To effect this, follow steps 1-3 above to set up the node type(s) as tagnodes. Finally, go to tagnode maintenance area to "fix" all existing nodes and thereby create the paired term for each.

To remove this module, you can simply disable the module in administer -> modules, then delete any tagnode-defining vocabularies if you wish. There is little residual footprint.

If you wish to have node types properly display as plural (as in 'see all stories' instead of 'see all story'), you might need to add your own implementation of the theme_type_name_display_tagnode() function, in your site's theme. The tagnode module contains a default implementation which properly pluraziles some node types.

ROADMAP

At this writing, there are other modules in this space (such as Clipper module) and several projects afoot to
create a Drupal core API for node-to-node relationships. I hope to merge this module with those efforts.
I would expect the functional result would be more granular control of the node linking & labeling, so that
custom text could be displayed when linking from 1 node type to another. Additionally there would
probably be improved performance, and support for tagging large sets of nodes to one another.

CHANGELOG
12/29/2005: fixed bug in "create new" links on node form, and fixed bug in tagnode_help
12/14/2005: committing rough 4.7 version to head. Head version of tagnode now is for Drupal 4.7