[drupal-devel] Question on taxonomy_form() function -- SOLVED

Scott Courtney scott at 4th.com
Thu Mar 31 18:35:04 UTC 2005


On Thursday 31 March 2005 11:33, Morbus Iff wrote:
> >  * Note that $tid_array['tags'] is a single-element sub-array containing one
> >  * string element with the free-form tags.
> 
> Not necessarily one. 'tags' is an array of vid keys, so that you could 
> have multiple "Free tagging" vocabularies for one node. If you had "Free 
> tagging 1" (vid 3) and "Free tagging 2" (vid 17) applied to "node", then 
> there would be two input boxes in the UI, and a submitted 'tags' would 
> contain the following:
> 
>   [tags] [3] => 'tags, applied, to, free tagging 1',
>   [tags] [17] => 'tags, applied, to, free tagging 2'

Yeah, I figured that out just after I posted, as I went back into working on
the code. Duh. I had been wondering where that "3" in my trace var_dump()
calls was coming from, never occurred to me it was a vid number. Thanks for
the concise explanation.

> 
> With that said, since your code doesn't touch 'tags' at all, things will 
> work as (I've) intended; the only thing to "fix" is your documentation.

[...]
 * For the outermost (non-recursed) invocation only, the parameter $keep_tags
 * (default TRUE) tells the function to retain, unmodified, any element of
 * the $tid_array whose subscript is 'tags'. This causes the subarray placed
 * by the free-tag patch to taxonomy.module to work correctly across previews.
 * Note that $tid_array['tags'] is a sub-array containing one or more string
 * element(s), indexed by vocabulary ID (vid), with the free-form tags.
[...]

Better? :-)

> 
> > This might be a useful function (if renamed) to include in taxonomy.module
> 
> Looks good. I'm not entirely sure I like the dependency on _image though, 
> but I'm sure we could make that a (non-)private function in taxonomy too.

Which is why I suggested renaming it. If you choose to add it into your patch,
you could call it something like taxonomy_extract_tids() and make it a non-
private API call. If you do that, I'll just drop the code from my module.

> 
> Good stuff!
> 

Laptop computer: $2200.
SuSE Linux DVD:  $89.
Drupal:          $0.
Having Morbus Iff call your code "good stuff": Priceless.

Thanks!

Scott

-- 
-----------------------+------------------------------------------------------
Scott Courtney         | "I don't mind Microsoft making money. I mind them
scott at 4th.com          | having a bad operating system."    -- Linus Torvalds
http://4th.com/        | ("The Rebel Code," NY Times, 21 February 1999)
                       | PGP Public Key at http://4th.com/keys/scott.pubkey



More information about the drupal-devel mailing list