Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top