One Hour Image Transitions
A very common request I get lately is for a banner containing a series of image transitions, often on the home page. Certainly a fairly simple feature, one I've already solved in different ways, E.g., here, here, and here. So when I had a similar need, I decided to finally build a stable and flexible module I could easily reuse. But as any good Drupal citizen knows, better to see what's already out in the contrib space before recreating the wheel. I also like to scour the landscape for any lateset and greatest libraries before a new project, in this case for JQuery image transitions. I came across Nivo Slider, which quickly led me to the corresponding Drupal module. Combine this with CCK (imagefield), Imagecache, and Views, bundle it into a Feature, and voila, a 1 hour flexible and reusable banner transition tool.
Final recipe is as follows.
Drupal Menu Hell(p)
I recently had to implement what seemed like a very simple feature for a client, moving several of the local tasks located on a user's profile page into the site's primary menu. The menu paths in question are dynamic, E.g, /user/%/edit, /user/%/orders, /user/%/notifications, etc., which at first seemed like slight complication. So how to tackle this? At first blush, one might think that you can just use the Menu module to add a dynamic menu item though the GUI or menu API. Well, that won't work. You can only create a menu item that way for an existing path that you have access to. Luckily, Drupal provides a hook that seems like the perfect solution,
<?php
function hook_menu_alter(&$items) {
// Example - disable the page at node/add
$items['node/add']['access callback'] = FALSE;
}
?>Great, so I can change the type of the menu items I want to alter by doing something like the code below and problem solved!
<?php
function mymodule_menu_alter(&$items) {
$items['user/%user/edit']['type'] = MENU_NORMAL_ITEM;
}
?>