Download the PHP package s2hub/silverstripe-cms-popup without Composer
On this page you can find all versions of the php package s2hub/silverstripe-cms-popup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download s2hub/silverstripe-cms-popup
More information about s2hub/silverstripe-cms-popup
Files in s2hub/silverstripe-cms-popup
Package silverstripe-cms-popup
Short Description Generic CMS modal popup for SilverStripe 6 with React content components
License MIT
Informations about the package silverstripe-cms-popup
silverstripe-cms-popup
Opens modal dialogs in the SilverStripe CMS from a button in the form action menu. Four built-in content types: Search (search with result selection), Batch (sequential processing of a queue), Content (generic HTML loader), and FormSchema (full SilverStripe form including HTMLEditorField).
Requirements: SilverStripe 6, PHP 8.2+
Installation
The module registers itself automatically in LeftAndMain. No additional YAML configuration required.
Search modal
Opens a dialog with a server-rendered search form. The user enters search terms; results are loaded via AJAX. Clicking a result fires a cms-modal:select event on the triggering button.
Create a handler class that extends CmsPopupSearchHandler:
The search endpoint is routed automatically via CmsPopupSearchRouterController at cms-search/.
autoSearch and initialQuery
autoSearch(bool, defaulttrue) — triggers a search immediately when the modal opensinitialQuery(string, optional) — pre-fills the query and is used for the initial search
Listening to the select event
Batch modal
Opens a dialog with a configuration form. After clicking "Start", queue items are sent one by one to an action endpoint; progress is displayed live.
The batch endpoints are routed automatically via CmsPopupBatchRouterController at cms-batch/.
Queue endpoint
getQueueItems() is called when a field named recursive is checked in the batch form. Items are merged with any static queue set via setBaseQueue(). Items with "enabled": false are skipped.
Action endpoint
processItem() is called via POST for each queue item. The request body contains the queue item merged with the form values as JSON:
Response helpers
| Method | HTTP status | Modal display |
|---|---|---|
success($message, $details) |
200 | green check |
warning($message, $details) |
200 | yellow warning |
error($message, $details) |
422 | red cross |
Detail severity: info (green), warning (yellow), error (red).
FormSchema modal
Opens a full SilverStripe form in the modal using FormBuilderLoader. Supports all CMS field types including HTMLEditorField (TinyMCE). The modal closes automatically after a successful save.
Create a handler class that extends CmsPopupHandler:
The form endpoint is routed automatically via CmsPopupAdminController at /admin/cms-popup/popup.
GridField column
Use CmsPopupGridFieldColumn to add a per-row popup button to a GridField:
After a successful save, the GridField is automatically reloaded.
Content modal
Loads arbitrary HTML from a URL into the dialog.
Button icon
A SilverStripe admin font-icon class can be added to any action button:
Modal sizes
| Value | Width |
|---|---|
sm |
480 px |
md |
640 px (default) |
lg |
860 px |
Writing the selected value into a form field
Typical pattern: open search modal → write selected value into a hidden field → save the form.
Custom content components
Register a custom React component via the SilverStripe Injector:
The component receives the props data (from setModalData()), onClose, onSelect, and onSaved.
Building assets
Output: client/dist/js/bundle.js and client/dist/css/cms-popup.css.