<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
 <title>Drupal High</title>
 <link>http://drupalhigh.onsugar.com</link>
 <description>Simple musings of a Drupal developer.</description>
 <language>en</language>
 <atom:link href="http://drupalhigh.onsugar.com/tag/hooks/rss" rel="self" type="application/rss+xml" />
<item>
 <title>Taxonomy Enhancer is not out for Drupal 6</title>
 <link>http://drupalhigh.onsugar.com/2400944</link>
 <description>&lt;a href=&quot;http://drupalhigh.onsugar.com/2400944&quot;&gt;&lt;/a&gt;&lt;p&gt;Thats too bad, this is a really useful module for adding data to taxonomy terms and vocubularies. There is a &lt;a href=&quot;http://drupal.org/node/305736&quot;&gt;patch brewing&lt;/a&gt;, but its just not ready yet. I had a client that was using taxonomy to define seasons for products (for example &quot;Fall 08&quot;, &quot;Holiday 09&quot;, etc). The taxonomy part was working great, but how do you know when a season starts or ends? These aren&#039;t necessarily your standard spring/summer/fall/winter, they can be fairly arbitrary. It would be nice to be able to store that information about a term without having to write a whole custom module, but unfortunately no Taxonomy Enhancer.&lt;br /&gt;&lt;br /&gt;So how hard is it to replicate the functinality from that module? Not too much trouble, just 2 hooks in fact.&lt;br /&gt;&lt;br /&gt;hook_form_alter() checking for a &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;$form_id&lt;/span&gt; of &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&#039;taxonomy_form&lt;/span&gt;&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;_term&lt;/span&gt;&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&#039;&lt;/span&gt; will let us add the fields to the page. In our case we only wanted this for terms in one vocabulary, so we also checked the vid and that the user had permission to edit the product seasons.&lt;br /&gt;&lt;br /&gt;the second part is using hook_taxonomy() to save the date. This hook gets called anytime a term or vcabulary is inserted, updated, or deleted. So we check to make sure that&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;its a term being modified (not a vocabulary) (&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;$type == &#039;term&#039;&lt;/span&gt;) &lt;/li&gt;
&lt;li&gt;its in the the vocabulary we&#039;re interested in (&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;$array[&#039;vid&#039;] == SEASON_VID&lt;/span&gt;)&lt;/li&gt;
&lt;li&gt;the user has permission to edit this kind of data (&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;user_access(&#039;administer seasons&#039;)&lt;/span&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If all of the above are true we store the data, and we&#039;re free to call it back later and make sure we&#039;re only showing the user the product seasons s/he is supposed to see!&lt;/p&gt;</description>
 <comments>http://drupalhigh.onsugar.com/2400944#comment</comments>
 <category domain="http://www.teamsugar.com/category/drupal">drupal</category>
 <category domain="http://www.teamsugar.com/category/tech">tech</category>
 <category domain="http://www.teamsugar.com/tag/modules">modules</category>
 <category domain="http://www.teamsugar.com/tag/hooks">hooks</category>
 <pubDate>Thu, 23 Oct 2008 00:20:09 -0700</pubDate>
 <dc:creator>krs</dc:creator>
 <guid>http://drupalhigh.onsugar.com/2400944</guid>
</item>
</channel>
</rss>
