2

I am using the simpledialog module with the 'edit' tab still in it. The edit overlay for the node is displayed in the background with the simpledialog still in the way.

I have tried a bunch of ways of attaching the close call to the edit button and triggering a click on the dialog close button. None of it very successfully - all iframes. e.g.

$htj2('.tabs.primary').delegate('click', 'a', function() {
    $hjt2('#simple-dialog-container').dialog("close");

I think the 'correct drupal pattern' is to attach a behavior to the form load using drupal behaviors.

(function ($) {
    Drupal.bahaviors.hotTopicsResearch = {
        attach: function(context, settings) {
            // ?? What next?
            $('#hot-topic-research-node-form',context).once('load', function() {

            });
        }
    }
})(jQuery);

How do I find out what the behaviours are? How do I attach to the load event or is there an event related to clicking on the 'edit' tab? How do I get close the simpledialog?

1
  • it seems like your trying to react to the wrong thing in JS. I assume you're reffering to like this page: drupal.org/node/1087026. You want to hide the simpledialog if you press Edit on a node page -- before the Overlay pops up. You would do that by attaching a simple JS event listener to look for something like $('a[href~=edit]').clicked() ... and then simply call simpledialog close or $('#simplediaglo').hide(). my point, I think your attacking it from the wrong direction with the code you've provided
    – tenken
    Commented Mar 1, 2013 at 3:47

1 Answer 1

1

Got it after a number of days searching:

(function ($) {
    Drupal.behaviors.hotTopicsResearch = {
        attach: function(context, settings) {

            $(document).bind('drupalOverlayBeforeLoad', function(event) {
                $('#simple-dialog-container', context).dialog('close');
            });
        },
        weight: 11
    }

})(jQuery);

The other events seem to have the wrong order. 'drupalOverlayOpen' almost works except that the editing overlay never 'becomes active'. This is why I was trying to work on the target editing screen events rather than the open dialog.

overlay_paths without there being'use case documentation' it looks like it only applies to menu items. How to manually use Drupal 7's admin Overlay? shows you how to add content nodes to the admin paths. This displayed my node in the admin overlay, but without the background context being visible - defeating the point - and with some further quirks.

1
  • I have exactly same problem and I'm not getting it solved :( I've tried the code you posted but the problem stays. Did you made any improvements after posting your code?
    – Elin Y.
    Commented May 23, 2014 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.