Grayside.Org - drupal6 http://grayside.org/category/terms/drupal6 en Drush Snippets: Menu Trace http://grayside.org/2012/08/drush-snippets-menu-trace <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Random snippet of the day, find out what modules are involved in building out a given menu route definition. When you type a <span class="caps">URI</span> into your browser, Drupal&#8217;s menu routing system connects that to your page content by processing the path into instructions for how to build the&nbsp;page.</p> <p>To use this script, copy the text or clone from github as a file, make it executable. It will automatically run with <code>drush php-script</code>. You can use <code>--verbose</code> for &#8220;full array notation&#8221; of each module&#8217;s change to the menu route. Or you can just use <code>--pipe</code> to get a list of modules and go look at the code&nbsp;directly.</p> <script src="https://gist.github.com/3326438.js"> </script> <p>In theory this should work with Drupal 7, but I haven&#8217;t gotten around to testing it&nbsp;yet.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item odd"><a href="/category/terms/drush">drush</a></div><div class="field-item even"><a href="/category/1/snippet">snippet</a></div><div class="field-item odd"><a href="/taxonomy/term/1">drupal</a></div></div></div> Sat, 11 Aug 2012 19:08:54 +0000 Grayside 99 at http://grayside.org http://grayside.org/2012/08/drush-snippets-menu-trace#comments Release: Organic Groups 6.x-2.3 http://grayside.org/2012/03/release-organic-groups-6x-23 <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Today was the release of <span class="caps">OG</span> 6, Version 2.3</p> <p>We have a fine assortment of changes (see the <a href="http://drupal.org/node/1507328">changelog</a>), ranging across:</p> <ul> <li>Extensive og.module commenting.</li> <li>Views integration improvements.</li> <li>Many &#8220;<span class="caps">OG</span>, what are you thinking?&#8221; bugfixes.</li> <li>And even some performance enhancements.</li> </ul> <p>This release covers three classes of issues:</p> <ul> <li>The remaining low hanging fruit languishing in the issue queue over the last two years.</li> <li>Lowish-hanging fruit that I had the time to finish myself.</li> <li>Development of enhancements and bugfixes I ran into during the work hours.</li> </ul> <p>As I presented last time, I have a bit of a <a href="http://groups.drupal.org/node/196863">manifesto on how I&#8217;m approaching changes to <span class="caps">OG6</span></a>. Unusual levels of conservatism have led to such oddities in a Drupal project as a function with a @deprecated tag.</p> <p>There are still items in progress in the issue queue, but since most everyone has moved on to the fantastic Drupal 7 version of Organic Groups, there are very few people contributing their efforts. That&#8217;s fine, but you can start to expect most changes to <span class="caps">OG6</span> to come by way of my own itches. I don&#8217;t use Notifications, I don&#8217;t use multi-group posting, I don&#8217;t use the audience widget. If you care about these things, please help the many people that share your plight and present some patches and reviews <a href="http://drupal.org/project/issues/og?version=6.x">in the&nbsp;queue</a>.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item odd"><a href="/category/terms/organic-groups">organic groups</a></div></div></div> Wed, 28 Mar 2012 21:27:05 +0000 Grayside 97 at http://grayside.org http://grayside.org/2012/03/release-organic-groups-6x-23#comments Release: Organic Groups 6.x-2.2 http://grayside.org/2012/01/release-organic-groups-6x-22 <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I have just tagged the first <span class="caps">OG6</span> release since March of 2010.</p> <p>We have a fine assortment of changes (see the <a href="http://drupal.org/node">changelog</a>), ranging across:</p> <ul> <li>New Hook <span class="caps">API</span> Documentation</li> <li>Views integration improvements</li> <li>Localization improvements</li> <li>Miscellaneous areas of moderate interest</li> </ul> <p>This release locks in some changes, clarifies the status of Notifications (sticking with the 2.x line for now), and sets up <span class="caps">OG6</span> for a stable position to start looking at what should happen next. I&#8217;ve posted a sort of maintainer&#8217;s philosophy position on how I see <span class="caps">OG6</span> moving forward, you can read it at the <a href="http://groups.drupal.org/node/196863">d.g.o address of Organic Groups</a>. What does all that translate into for my next steps?</p> <p>Well, aside from a few clear cases, it&#8217;s still very much up to the community. I&#8217;m going to focus on a few good patches, and see if I can help the <a href="http://drupal.org/project/issues/search/og?text=&amp;assigned=&amp;submitted=&amp;participant=&amp;status%5B%5D=Open&amp;issue_tags_op=or&amp;issue_tags=gdolove">groups.drupal.org-related issues</a>, <a href="http://drupal.org/project/issues/search/og?text=&amp;assigned=&amp;submitted=&amp;participant=&amp;status%5B%5D=Open&amp;issue_tags_op=or&amp;issue_tags=performance">performance</a>, and <a href="http://drupal.org/project/issues/search/og?text=&amp;assigned=&amp;submitted=&amp;participant=&amp;status%5B%5D=Open&amp;issue_tags_op=or&amp;issue_tags=og-wtf">the Weirdness</a> subqueues. I&#8217;m hoping to have enough cool stuff pulled together to release 2.3 in honor of Drupalcon&nbsp;Denver.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item odd"><a href="/category/terms/organic-groups">organic groups</a></div></div></div> Fri, 13 Jan 2012 19:16:45 +0000 Grayside 95 at http://grayside.org http://grayside.org/2012/01/release-organic-groups-6x-22#comments D7 Upgrade Process: Backports to Close the Gap http://grayside.org/2011/08/d7-upgrade-process-backports-close-gap <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p><em>The following post originally appeared on the <a href="http://goingon.com/blog/d7-upgrade-process-backports-close-gap">GoingOn.com blog</a>.</em></p> <p>After more than a year of continuous investment in <a href="http://goingon.com">GoingOn</a>&#8217;s Drupal 6 platform, the idea of upgrading to Drupal 7 is incredibly daunting. We have custom modules from form behaviors down to the access layer, we have features encapsulating hundreds of exported components, and an aggressive feature release schedule that does not set aside 6 months for a complete rewrite of the codebase just for a new version of Drupal. What to&nbsp;do?</p> <p>We’ve been playing around with the idea of iterating our Drupal 6 platform toward Drupal 7. By pulling markup, design patterns, APIs, and architecture in Drupal 7 down into platform incrementally, we hope to shorten the final leap that will come when upgrading the entire&nbsp;system.</p> <h5>Driving Current Drupal Version Closer to Expected Drupal&nbsp;Version</h5> <p><img src="http://goingon.com/sites/default/files/Drupal_Steps_4.png" alt="" width="200" height="202" /></p> <p><sup>Usability metaphors in site architecture and development practices sometimes works.</sup></p> <p>The extra work involved might well take <em>more aggregate</em> time to develop, but that time will be amortized across small, manageable pieces that can be more intelligently inserted into the development&nbsp;schedule.</p> <p>Here are the backport opportunities we’ve&nbsp;identified:</p> <h3>Design&nbsp;Patterns</h3> <p><a href="http://drupal.org/project/vertical_tabs">Vertical Tabs</a>, <a href="http://drupal.org/project/contextual">Contextual Links</a>, Toolbar, <a href="http://drupal.org/project/elements">Elements</a>, <a href="http://drupal.org/project/contact">Contact</a></p> <p>Many of the design patterns in Drupal 7 are available through a combination of backport modules and creative theming. The Toolbar module doesn’t have a backport, but peeking into the repository for the <a href="http://drupal.org/project/admin_menu">Admin Menu</a> I spy something that makes it <em>look</em> like D7’s&nbsp;Toolbar.</p> <p>By pulling these patterns from D7, we gain two&nbsp;benefits:</p> <ul> <li>We can build out the rest of our user interface around D7 design assumptions, instead of D6 assumptions. This will save effort in a theme redesign and&nbsp;upgrade.</li> </ul> <ul> <li>We can trickle D7 designs in front of our users, allowing them to adjust to a few changes ahead of time instead of waking up one morning to find a completely rearranged&nbsp;website.</li> </ul> <p><em>Our use of Vertical Tabs liberally around node forms is not cutting edge, but has allowed us to package complex forms with a Drupal 7 pattern, instead of resorting to harder-to-maintain multi-step&nbsp;forms.</em></p> <h3>System&nbsp;Plumbing*</h3> <p><a href="http://drupal.org/project/drupal_queue">Drupal Queue</a>, <a href="http://drupal.org/project/adminrole">Admin Role</a>, <a href="http://drupal.org/project/password">Password</a>, <a href="http://drupal.org/project/hook_file">File</a>, <a href="http://drupal.org/project/mailsystem">Mail System</a>, <a href="http://drupal.org/project/simpletest">Simpletest</a></p> <p>The flow of code that goes on under the hood has a few interface points where it is relatively easy to grab a D6 backport and make your modules look just a little more like Drupal 7&nbsp;code.</p> <p>Judging by an <span class="caps">IRC</span> chat I just overheard the files[] mechanism might be dropped for something simpler in one of the next few point&nbsp;releases.</p> <p><em>I hadn’t realized until writing this that <span class="caps">URL</span> Alter was cooked into core. The ability to ignore the special rules around around <a href="http://api.drupal.org/api/drupal/developer--hooks--core.php/function/custom_url_rewrite_inbound/6">custom_url_rewrite_inbound()</a>  and go straight for <a href="http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_url_inbound_alter/7">hook_url_inbound_alter()</a> is great. It also makes our custom code using it D7&nbsp;ready.</em></p> <p>* For purposes of this post, plumbing refers to the flow of code and data between its storage and the rendering process. Pretty broad&nbsp;category.</p> <h3>Database <span class="amp">&amp;</span>&nbsp;Performance</h3> <p><a href="http://pressflow.org/">Pressflow</a>, <a href="http://drupal.org/project/dbtng"><span class="caps">DBTNG</span></a>, <a href="http://drupal.org/project/cache_backport">Cache&nbsp;Backport</a></p> <p>You can get a lot closer to Drupal 7 performance behaviors simply by using Pressflow, which has held backports from and experiments for Drupal 7 for&nbsp;years.</p> <p><em>Most members of the Drupal community are already well aware that if performance is important for your project, grabbing Pressflow is an easy and non-threatening win. By using it for D6, you will be coding against session handling that is closer to D7’s, as well as being able to make use of other performance enhancing systems, such as serving images via <a href="http://drupal.org/project/varnish">Varnish</a> as an ongoing improvement across your upgrade&nbsp;process.</em></p> <h3>Contrib&nbsp;Backports</h3> <p>This is a category of another sort. Usually when you think about Contrib modules for D7, you are looking for the upgraded version of the modules you are already using. However, what if there is a D7 module you want to use, or at least, could use? The D6 version of that module has just become a backport to facilitate your upgrade&nbsp;path.</p> <p>This is a good solution to deal with unmaintained modules that have since been eclipsed by more energetic projects, as well as custom code you don’t really want to see again. We’re pretty excited to start playing with the <a href="http://drupal.org/project/boxes">Boxes </a>module for this&nbsp;reason.</p> <p>I’m going to skip listing competing modules in which one has an upgrade path and not the other. The <a href="http://groups.drupal.org/similar-module-review">Similar Module Review</a> group might have information that will help you find competing modules that may just be a cleaner path&nbsp;forward.</p> <p><em>Thanks to <a href="http://www.lullabot.com/articles/friday-roundup-drupal-8-education-agile-bacon-and-roombas">Lullabot’s Friday Roundup </a>(June 24th) for pointing out backports of Password, Contact, and File. Thanks to David Reid for creating and maintaining what seems like most of these&nbsp;modules.</em></p> <p><em><strong>So, did this work? </strong>We are still putting together the details of this plan. A followup post in a few months will report on how it goes. If you have thoughts about this approach to the upgrade, additional worthwhile backports, or alternate ideas on how to make the time for an upgrade, please post a&nbsp;comment!</em></p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item even"><a href="/taxonomy/term/84">drupal7</a></div><div class="field-item odd"><a href="/taxonomy/term/85">upgrade</a></div></div></div> Wed, 17 Aug 2011 05:40:01 +0000 Grayside 92 at http://grayside.org http://grayside.org/2011/08/d7-upgrade-process-backports-close-gap#comments Node Form Dominos via Node Reference and Prepopulate http://grayside.org/2010/09/node-form-dominos-node-reference-and-prepopulate <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>I like Prepopulate. I like to have that pseudo-RESTful way of preloading a form to minimize the amount of work a user has to do to get to the point of submitting a form. But I also like clean URLs. This post reviews in detail a technique to use a single prepopulated nodereference field to prepopulate a bunch of other fields based on that reference. Since <a href="http://drupal.org/project/prepopulate">Prepopulate&#8217;s</a> recent 2.0 release, it because a whole lot more difficult to use the <a href="http://drupal.org/node/37775">Form <span class="caps">API</span></a> to work magic on what it provides.</p> <p>I use this in conjunction with nodereference to tailor node forms for their relationship with the referenced node.</p> <h2>Step 1: Setting up your links</h2> <p>In order for anything to happen, first you need to shape your links properly. The way to use Prepopulate with Node Reference fields (any many others) has subtly shifted. In the case of nodereference, you now what your querystring to look like this:</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal">edit<span style="color: #009900;">&#91;</span>field_my_nodereference_field<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>∆<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>nid<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>nid<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>nid<span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">###]</span></pre></div> </div> <p>Where <strong>∆</strong> is the delta of your field (probably 0), and <strong>###</strong> is the Node <span class="caps">NID</span>.</p> <h2>Step 2: Set up a module</h2> <p>Create a new module, or use any old custom module you have laying around. Be sure it&#8217;s weight is higher than Prepopulate&#8217;s lofty &#8220;10&#8221;, because your module needs to react to what Prepopulate does. Read up on <a href="http://drupal.org/node/110238">setting your module&#8217;s weight</a> if need be.</p> <p>You could avoid worrying about module weight if you wanted to wrangle the <span class="caps">URL</span> on your own, but at that point why are you using Prepopulate?</p> <h2>Step 3: hook_form_alter() and #after_build</h2> <p>This post won&#8217;t review how to use hook_form_alter(), but if you do not know about this amazing function, I am shocked. <a href="http://api.drupal.org/api/function/hook_form_alter/6">Go read up on it</a>. <a href="http://api.drupal.org/api/drupal/developer&#8211;topics&#8211;forms_api_reference.html/6">Master it</a>. And return here.</p> <p><em>hook_form_alter()</em> is great to change a form before it&#8217;s built. But Prepopulate now applies it&#8217;s changes after the form is built. That means you need to use <em>#after_build</em> to specify another function to come along after Prepopulate, grab the values it has applied, and make your changes.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">function</span> custom_form_alter<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$form</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$form_state</span><span style="color: #339933;">,</span> <span style="color: #000088;">$form_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #666666; font-style: italic;">// You might want to put a check somewhere that this should only apply to</span> &nbsp; <span style="color: #666666; font-style: italic;">// new users or new nodes. For example, if ($form['#node']-&gt;nid == <span class="caps">NULL</span>)</span> &nbsp; <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'#after_build'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'custom_prepopulate_after_build'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>Step 4: Grab the referenced node.</h2> <p>In order to inherit some values from the referenced node, you need to load it.</p> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">function</span> custom_prepopulate_after_build<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$form_state</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> node_load<span style="color: #009900;">&#40;</span>custom_prepopulate_nodereference_nid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'field_my_nodereference_field'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Bad reference from prepopulate. Nothing more to be done.</span> &nbsp; &nbsp; <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Do stuff to your form here.</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// <span class="caps">DO</span> <span class="caps">NOT</span> <span class="caps">FORGET</span> <span class="caps">THIS</span>!</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #009933; font-style: italic;">/** &nbsp;* Get the nid from the string [nid: #] &nbsp;* &nbsp;* @param $value &nbsp;* &nbsp;String containing the nid. &nbsp;* &nbsp;* @return &nbsp;* &nbsp;Integer value of a prospective nid. &nbsp;* @see nodereference_autocomplete_validate &nbsp;*/</span> <span style="color: #000000; font-weight: bold;">function</span> custom_prepopulate_nodereference_nid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form_field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^(?:\s\*|(.\*) )?\[\s\*nid\s\*:\s\*(\d+)\s\*\]$/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Explicit [nid:n].</span> &nbsp; &nbsp; <a href="http://www.php.net/list"><span style="color: #990000;">list</span></a><span style="color: #009900;">&#40;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nid</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$nid</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;"><span class="caps">NULL</span></span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>Step 5: Time for dominos</h2> <p>Now that we have a code skeleton with all the data we need, we can start in with some magic.</p> <p>Put things like this in the &#8220;do stuff&#8221; section commented in the code block above.</p> <h3>Title Inheritance</h3> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'#default_value'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'#value'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Discussion of &quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h3>Taxonomy Inheritance</h3> <div class="geshifilter"> <div class="php geshifilter-php" style="font-family:monospace;"> <pre style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'taxonomy'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tags'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$vid</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$taxonomy</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_numeric"><span style="color: #990000;">is_numeric</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'taxonomy'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tags'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$vid</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'#default_value'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; &nbsp; <span style="color: #000088;">$form</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'taxonomy'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tags'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$vid</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'#value'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> taxonomy_implode_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">taxonomy</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span></pre></div> </div> <h2>Was that complex?</h2> <p>Seems a bit involved, so I&#8217;m working out the best way to produce a helper module.</p> <p>If what you want is to inherit values into your output, check out the <a href="http://drupal.org/project/field_inherit">Field Inherit</a>&nbsp;project.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/prepopulate">prepopulate</a></div><div class="field-item odd"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item even"><a href="/category/terms/nodereference">nodereference</a></div><div class="field-item odd"><a href="/category/terms/ux">ux</a></div></div></div> Thu, 02 Sep 2010 20:47:04 +0000 Grayside 88 at http://grayside.org http://grayside.org/2010/09/node-form-dominos-node-reference-and-prepopulate#comments Single Group Login Redirect http://grayside.org/2010/04/single-group-login-redirect <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p><a href="http://community.openatrium.com">Community.<span class="caps">OA</span></a> had a <a href="https://community.openatrium.com/issues/node/1805">request</a> for functionality that would redirect a user with a single group membership to that group&#8217;s homepage.</p> <p><a href="http://tinkercms.grayside.org/projects/oa-single-group-login-redirect">I packaged that functionality up as a Feature</a>, so you can use it too. The <em>oa_</em> prefix refers to the support for spaces_og/purl to generate a group&nbsp;<span class="caps">URL</span>.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/openatrium">openatrium</a></div><div class="field-item odd"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item even"><a href="/category/terms/organic-groups">organic groups</a></div><div class="field-item odd"><a href="/category/terms/rules">rules</a></div><div class="field-item even"><a href="/category/terms/login">login</a></div></div></div> Wed, 28 Apr 2010 21:39:37 +0000 Grayside 64 at http://grayside.org http://grayside.org/2010/04/single-group-login-redirect#comments Freelinking 1.9 Release Sighted http://grayside.org/2010/03/freelinking-19-release-sighted <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>Freelinking 1.x was previously announced as feature-frozen, and the next thing to unsupported. Looking at the long development cycle for Freelinking 3 reaching stability, the issue queue was dusted off.</p> <p>Freelinking 1.9 will fix a number of bugs in 1.8, and smooth out the transition to <span class="caps">FL3</span>. Please go on over to the <a href="http://drupal.org/project/freelinking">Freelinking</a> homepage and download the <a href="http://drupal.org/node/180838">dev version</a> to try it out.</p> <p>Freelinking 1.9 will be released this&nbsp;week.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/category/terms/freelinking">freelinking</a></div><div class="field-item odd"><a href="/category/terms/modules">modules</a></div><div class="field-item even"><a href="/category/terms/drupal6">drupal6</a></div></div></div> Sun, 28 Mar 2010 06:31:37 +0000 Grayside 59 at http://grayside.org http://grayside.org/2010/03/freelinking-19-release-sighted#comments Overriding Prepopulate: Do Not Use hook_form_FORM_ID_alter http://grayside.org/2010/02/overriding-prepopulate-do-not-use-hookformformidalter <div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>&gt; <strong><span class="caps">EDIT</span>: As of Prepopulate 2.0, you cannot directly use hook_form_alter() anyway. See <a href="http://grayside.org/2010/09/node-form-dominos-node-reference-and-prepopulate">Node Form Dominos</a> to learn about using #after_build to work with Prepopulated values. &#8211; 2010/09/09</strong></p> <p>The <a href="http://drupal.org/project/prepopulate">Prepopulate</a> module works some great magic to preload forms from <span class="caps">URL</span> variables. But suppose you need some extra magic to modify the titles it puts in place?</p> <p>You can always use <tt>hook_form_alter</tt> (and <a href="http://drupal.org/node/651106">here</a> is one of countless little tutorials on that).</p> <p>If you already know about that, you might be someone that enjoys the use of <tt>hook_form_FORM_ID_alter()</tt>. If you do, you <strong>cannot</strong> use it to override Prepopulate-set fields. It turns out that regardless of module weight, <tt>hook_form_FORM_ID_alter</tt> is called before <tt>hook_form_alter</tt> for any given form, meaning that the more specific function will always set the value, then Prepopulate will come along and reset it to your <span class="caps">URL</span> value.</p> <p>There is a nice issue (<a href="http://drupal.org/node/300481">#300481</a>) that details this problem, and hopefully will find itself fixed in Drupal&nbsp;8.</p> </div></div></div><div class="field field-name-taxonomy-vocabulary-1 field-type-taxonomy-term-reference field-label-above"><div class="field-label">Terms:&nbsp;</div><div class="field-items"><div class="field-item even"><a href="/taxonomy/term/1">drupal</a></div><div class="field-item odd"><a href="/category/terms/prepopulate">prepopulate</a></div><div class="field-item even"><a href="/category/terms/drupal6">drupal6</a></div><div class="field-item odd"><a href="/category/terms/hookformalter">hook_form_alter</a></div><div class="field-item even"><a href="/category/terms/drupal8">drupal8</a></div></div></div> Fri, 12 Feb 2010 19:31:30 +0000 Grayside 54 at http://grayside.org http://grayside.org/2010/02/overriding-prepopulate-do-not-use-hookformformidalter#comments