User login

Drupal Development

Having the top-level menu items not be links (for use with dropdown menus)

The best approach may be to avoid this entirely with proper information architecture. I always try to make these have meaning themselves, but certainly with not expecting most people to click on them anyway, this does not always make sense. Instead, the way Agaricer Kathleen did it for one project is simply to have each dropdown be a separate menu.

But let's say you are stubborn and don't like that approach or are too far down the path of a big old nested primary links menu. What do you do? Call Agaric, of course (or find this web page).

PHP knowledge resources used at Agaric

The big one, PHP.net itself

http://php.net

PHP.net has an excellent function search such that if you simply append the function name to the url (such as php.net/explode), it will serve up the PHP manual page with the specification and notes right away-- and if you use a function name that doesn't exist, it will provide a range of suggestions you might have meant.

Unset certain values in an unkeyed PHP array

Can't be as complicated as these people make it out to be?
http://dev-tips.com/featured/remove-an-item-from-an-array-by-value

One of Agaric's approaches, below. This foreach allows one to unset just one validation function associated with a form (and adds another one below) without replacing or overriding any other validation callbacks that might be associated with the form (by the initial or other modules).

"Content profile registration broken": debugging rogue form validate overrides

Bad coding in a development partner's custom module was the culprit. It was overriding content_profile_registration's setting of a validation function (and every other module's, too).

Inside the custom module's implementation of hook_form_alter() lives the error:

Undo a conflicting change in your working copy that you didn't want anyway

In short, resolve a conflict in favor of the outside repository.

The file can be a

mv offending.file ~/elsewhere
git checkout offending.file

See also for resetting everything: http://agaric.com/note/git-update-and-ignore-local-changes

Example of hook_block in Drupal 6

<?php
/**
* Implementation of hook_block().
*/
function fightfi_block($op = 'list', $delta = 0) {
  $block = array();
  switch ($op) {
    case 'list':
      $block[0]['info'] = t('Sidebar Links');
      $block[1]['info'] = t('Footer Links');
      return $block;
    case 'view':
      switch ($delta) {
        case 0:

Drupal 7 module development gotchas

First we discovered that you need a .module file for your module to be recognized. A .info file is not enough. (In this case, we only wanted the .install file, we made an empty .module file, and all was well. But then we wanted to add some functions to that empty .module file...)

Now we have found that you need to declare

files[] = agaric_example.module

in your agaric_example.info file for your agaric_example.module to be read!!!

Making changes to a nested array that may have arrays or strings in some values

Pulled this from the test module for the new RDF module we're putting in Drupal core.

// dealing with a nested array where the top level can be a string or an
// array is complex and helper functions may be a good addition

<?php
  rdf_mapping_alter_create('rdf_test_container', 'title', )

Upgrading Drupal modules

Automated help:
http://drupal.org/project/deadwood

http://drupal.org/project/coder also has upgrade assisting functionality.

General best practices and Drupal 5 to 6:
http://drupal.org/node/114774

Resolution

Syndicate content