iliain/silverstripe-popup
最新稳定版本:1.0.0
Composer 安装命令:
composer require iliain/silverstripe-popup
包简介
Adds a field to quickly generate a CMS popup
README 文档
README
Adds a popup field to the CMS, to quickly build a popup form.
Thanks to sheadawson for his original Linkable module, I was able to mimic his use of entwine to set this up.
Installation (with composer)
composer require iliain/silverstripe-popup
Config
TODO
Usage
You can implement a PopupField like so:
// necessary config $customLink = '/PopupForms/form'; $customBodyJS = <<<JS // custom js goes here JS; // method A PopupField::create('PopupForm', 'I am a popup', $customLink, $customBodyJS); // method B PopupField::create('PopupForm', 'I am a popup') ->setFormURL($customLink) ->setFormCustomCode($customBodyJS);
You will need to provide your own URL to load the form HTML from, and JS to set what the popup will do/how it will submit. This will be inserted into the existing popup form code for you. Without it, the popup will open but fail to load any content/submit.
An example of the custom JS:
// On Button Click this.getDialog().on('click', 'button', function () { $(this).addClass('loading ui-state-disabled'); }); // On Submit this.getDialog().on('submit', 'form', function () { const options = {}; options.success = function (response) { const button = self.getDialog().find('button'); $(button).removeClass('loading ui-state-disabled'); }; $(this).ajaxSubmit(options); return false; });
See the docs for a full example
TODO
- Add more customisation functions?
- Test multiple popups active on the same page
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-08-07