Download & Extend

Move options into Drupal.settings.Dialog.defaults so they can be overridden

Project:Dialog API
Version:7.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)

Issue Summary

I found myself needing to make all dialogs non-draggable and non-resizable. There wasn't an easy way to do this without hitting every command that opened them or replacing Drupal.CTools.AJAX.commands.dialog_display. Instead it seemed best to move the values we pass as dialog('options', $foo, $bar) into one place Drupal.settings.Dialog.defaults so we could override them or add in additional values.

This way I was able to do the following:

<?php
   
// Add default settings for dialog so they're consistent.
   
$settings['Dialog']['defaults']['draggable'] = FALSE;
   
$settings['Dialog']['defaults']['resizable'] = FALSE;
   
drupal_add_js($settings, 'setting');
?>

wonder95 helped with this patch.

Comments

#1

AttachmentSize
dialog_1096680.patch 3.01 KB

#2

Version:6.x-1.x-dev» 7.x-1.x-dev
Status:needs review» patch (to be ported)

committed to 6.x-1.x, kicking it over to 7.x for review.

#3

While I agree default settings should be configurable, you could, for now, of course override default JS behavior by overriding:

Drupal.ajax.prototype.commands.dialog_display = function(ajax, response, status) {
    ...
}
nobody click here