Modal Dialogs in Drupal 6

The Drupal/AJAX revolution continues, and Drupal 6 picks up the pace conciderabily. The cleanups in the APIs for menu and form make it much easier to use Ajax to pull in content. In particular the menu_execute_active_handler() call is fantastic for Ajax, since it returns the content of a page stripped of all the chrome.


These improvements have allowed me to create a module for Drupal 6 that can present pages as popups. This is amazingly useful for things like confirmation pages. And the best part is it can be applied retroactively to a page without needing to modify the generating module, and (of course) it degrades gracefully.


Checkout a screencast of how slick this makes the URL Alias admin page: http://starbowconsulting.com/files/popups.swf (sorry about all the artifacts, this is my first screencast).


I also have popups worked out for the menu and blocks admin pages as of alpha2: http://drupal.org/project/popups


Limitations (wow, lots of progress since I wrote this):

  • Currently I can only attach the popup behavior to core modules that have a form in them, since I am using hook_form_alter to include the javascript. So I haven’t figured out how to attach to taxonomy’s admin page (for example).
  • Page reload does not work with IE7. Cursor does not appear in textfields with Firefox. Works great with Opera.
  • Drupal still sends the entire page as a response to a form submission. I would love to tighten this to just send the page content (like menu_execute_active_handler() does), but I am not sure if it is possible.

AttachmentSize
popups.swf578.16 KB