One of my requirements is to show the user registration form in an overlay kind of interface.
From the Examples module issue queue, comment #14 http://drupal.org/node/930058 I found a module, learned the hook_admin_paths() and hook_admin_paths_alter(). I installed that module in my local test site. Added "user/register"
path to $paths
of hook_admin_paths()
and granted permissions to use overlay. It works pretty much as expected with the click event however my requirement is to trigger the overlay for onpageload event.
I tried calling a js script which would trigger click event from hook_overlay_parent_initialize()
and module's info file by settings scripts[] = myoverlay.js
.
The js script looks as below,
(function ($) {
Drupal.behaviors.loginLoad = {
attach: function (context, settings) {
alert("trigger client event"); // works
$(".menu-589 a").attr("title", "click"); // works
$(".menu-589 a").trigger("click");
// This one didn't work. Tried triggerHandler() and click() as well.
}
};
})(jQuery);
My jQuery expertise is very limited. I'm trying to figure out how the overlay fires for onclick event.
From what I learned the paths to be opens in overlay are defined in Drupal.settings.overlay.paths.admin
. And overlay-parent.js and jQuery BBQ does some tricks to show things in modal window.
Any help to figure out this will be appreciated.
On a side note : For Drupal 6 projects I have used modal frame api module often with onclick event. This module doesn't seems to be available for Drupal 7 and it is going to be deprecated in favor of overlay in core. Is overlay an API module ? It doesn't appear to be the case from my experience.