I would like to implement these two features, as discussed in #155411: Can the associated node be assigned the taxonomy term? for Drupal 6. However, I don't know what should be different from http://drupal.org/files/issues/nat-module-155411-24.patch in the scope of Drupal 6.

Is there anyone who knows there way around D6 that could collaborate with me on this?

CommentFileSizeAuthor
#2 nat.auto-association.patch12.92 KBwhite-raven

Comments

white-raven’s picture

Clarification: The linked patch above only attempts to implement the first of these two features (associate NAT node with its own NAT term).

white-raven’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new12.92 KB

Here's a patch for the first feature.

Some issues I ran into getting there:

  • The taxonomy module was overwriting my changes from a call to taxonomy_node_save when being called from within nat_nodeapi because it implements hook_nodeapi and gets called second. I solved this by tweaking the $node->taxonomy array. I still call taxonomy_node_save because I shouldn't depend on the order in which the hook is implemented, and sometimes taxonomy updates are made from somewhere other than nat_nodeapi.
    Ideally, the developers of the Taxonomy module would receive $node by reference, and change $node->taxonomy for you as well as updating the database.
  • $node->taxonomy is laid out differently depending on whether you are submitting a node from a form, or you loaded it using node_load. I wrote helper functions to deal with this.
  • If some NAT nodes already exist and this auto-association feature gets turned on, the Sync tab creates the missing associations in the term_node table. Reversing this is trickier, and is not yet implemented.

There are several new functions because handling potential cases with inserting and syncing required more code than initially anticipated.

Kudos to the Devel module developers; it came in really handy. Again, this patch doesn't cover the second feature.

Zen’s picture

Status: Needs review » Closed (duplicate)

Please use the original issue and restrain your patch to the issue at hand.

Thanks,
-K