I'm using the ctools modal ajax functionality for several forms across my site. I'm really digging it.

I would also like to use the modal functionality to display non-ajax(hidden) content on the page. Currently, this is pretty easy to do with thickbox or colorbox but I would prefer to only maintain one modal dialoge theme instead of one for colorbox/thickbox and for ctools.

Any idea on if this is possible?

Comments

merlinofchaos’s picture

Status: Active » Fixed

Yes, absolutely. You'll need to create your own behavior, but it would look something like this:

Drupal.behaviors.MyModuleBehavior = function() {
  $('a.classname').click(function() {
    Drupal.CTools.Modal.show();
    $('#modal-title').html(command.title);
    $('#modal-content').html(command.output);
    Drupal.attachBehaviors();
  });
}

You can send a setting string to the show() to pick a settings array, which is normally set from the server. Check out ctools/js/modal.js to see how this is used. It's a little bit opaque, I'm afraid, it won't be completely straightforward but it's not too terrible.

squaretone’s picture

Status: Fixed » Closed (fixed)

Easy cheesy. Thanks!