Darko Hrgovic's Blog

Drupal 6 - Expand Advanced Search fieldset if no keywords

Add this to your helper module: 

  /**
   * Implementation of hook_form_alter().
   *
   */
  function agentic_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
      case 'search_form':
      if (!arg(1)) { // if it's only /search and no keywords, expand the advanced search fieldset
      $form['advanced']['#collapsed']=FALSE;
      }
      break;
    }
  }
 

Create a select box from a nodequeue

We had the need to make a select box from a nodequeue in Drupal 6. Don't ask me why, as selects aren't the best UI, but that's a different discussion. There's probably a way easier way to do this, and niftier with jQuery, etc., but project budgets are what they are.

In our helper module, created this function (change 'mymodule' to whatever you have named your module): 

Drupal computed field code snippet for counting nodereferences - Addendum

When I first posted this, the sql query seemed to work fine, but after a bit of testing I noticed that node revisions will muck it. The query needed to get more complicated to look for the max vid instead of just relying on the nid. The symptom was that I would delete a nodereference, but it would still be counted (it would still count the previous revision's value). The revised computed field value is below.

Computed Field module asks us to add code snippets to the handbook pages, but they're nowhere to be found after the D6 upgrade. http://drupal.org/node/126522

Here's one that I just created to calculate the number of nodereferences for a cck type.

Background: 

CCK types
Venue
Event (includes datestamp field and is node referenced to Venue)

Collapsible fieldsets in and out of Drupal

Tags:

Examples of collapsible fieldsets can be found at

http://staging1.agentic.ca/jquery/fieldsets.php

Collapsible fieldsets in Drupal nodes

Tags:

This is an example of Drupal's collapsible fieldsets. Input type = PHP because you need to include misc/collapse.js.

Drupalcamp Vancouver 2008

Drupalcamp Vancouver 2008 has come and gone. A great time was had by all at this inaugural event, sponsored in part by Agentic.

See the pics: http://www.flickr.com/photos/djwa/

Darko presented Views argument handling code first thing Friday morning at the Wosk Center for Dialogue. The talk centered on the idea that adding a little code to a view argument can go a long, long way. Download the slides here.