views:

116

answers:

2

I wrote a module that uses the Ctools Modal Window to serve a form wizard. I would like to switch to using the Modal Frame API (which uses the JQuery UI Dialog as the modal). If someone has some experience making this type of switch in their code and can give me some pointers, I would appreciate it.

Thanks,

David


Update:

So I finally got around to making this change and this is what I learned:

  • On the server side code replace ctools_modal_add_js() with modalframe_parent_js()

  • On the client side js code where you may do $('#modal_link').click(Drupal.CTools.Modal.clickAjaxLink); Replace Drupal.CTools.Modal.clickAjaxLink with your own custom function.

Clearly the ctools modal window is way easier to use because in most cases you wouldn't even have to bother with creating any js like above. But, there you have it.

+2  A: 

I have never used CTools, but the Modal Frame API is very straight forward to use. You can have a look how I used it in my Sticky Notes module.

The documentation of ModalFrame API is quite comprehensive.

berliner
Thanks berliner, but I was kind of looking for a simple how to go from A to B thing.
DKinzer
A: 

So I finally got around to making this change and this is what I learned:

  • On the server side code replace ctools_modal_add_js() with modalframe_parent_js()

  • On the client side js code where you may do $('#modal_link').click(Drupal.CTools.Modal.clickAjaxLink); Replace Drupal.CTools.Modal.clickAjaxLink with your own custom function.

Clearly the ctools modal window is way easier to use because in most cases you wouldn't even have to bother with creating any js like above. But, there you have it.

DKinzer

related questions