From e23571875502a9abd92db2a74ca020cbf13f44b5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 26 Aug 2021 17:34:20 +0200 Subject: [PATCH] update docs --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index 59bc5dc..323a826 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,45 @@ public function import_stuff(HTTPRequest $req) } ``` +## Modal action + +This feature require my [cms-actions](https://github.com/lekoala/silverstripe-cms-actions) module. + +```php + public function getCMSActions() + { + $actions = parent::getCMSActions(); + $doDeny = new PureModalAction("doDeny", "Deny"); + $predefinedText = <<setFieldList($iframeFields); + $doDeny->setShouldRefresh(true); + $actions->push($doDeny); + } +``` + +It creates a button that opens a modal with a set of fields. These fields +are submitted alongside the form. + +```php + public function doDeny($data) + { + $this->DeniedReason = $data['EnterText']; + $this->Status = "denied"; + $this->write(); + return 'Denied'; + } +``` + ## Compatibility Tested with 4.x