从 Ctools Modal 到 Modal Frame API 的路径是什么

发布于 2024-09-11 00:09:27 字数 679 浏览 1 评论 0原文

我编写了一个模块,它使用 Ctools Modal 窗口来提供表单向导。我想切换到使用 模态框架 API (它使用 JQuery UI 对话框作为模态) 。如果有人有在代码中进行此类切换的经验并且可以给我一些指示,我将不胜感激。

谢谢,

大卫


更新:

所以我终于开始做出这个改变,这就是我学到的:

  • 在服务器端代码替换 ctools_modal_add_js()modalframe_parent_js()

  • 在客户端js代码上 可以做 $('#modal_link').click(Drupal.CTools.Modal.clickAjaxLink); 代替 Drupal.CTools.Modal.clickAjaxLink 使用您自己的自定义函数。

显然,ctools 模式窗口更容易使用,因为在大多数情况下,您甚至不必像上面那样费心创建任何 js。但是,你已经有了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美人如玉 2024-09-18 00:09:27

我从未使用过 CTools,但 Modal Frame API 的使用非常简单。您可以看看我如何在我的便签模块中使用它。

ModalFrame API 的文档相当全面。

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.

何以心动 2024-09-18 00:09:27

所以我终于开始做出这个改变,这就是我学到的:

  • 在服务器端代码替换
    ctools_modal_add_js()
    modalframe_parent_js()

  • 在客户端js代码上
    可以做
    $('#modal_link').click(Drupal.CTools.Modal.clickAjaxLink);
    代替
    Drupal.CTools.Modal.clickAjaxLink
    使用您自己的自定义函数。

显然,ctools 模式窗口更容易使用,因为在大多数情况下,您甚至不必像上面那样费心创建任何 js。但是,你已经有了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文