Download the PHP package restruct/silverstripe-simpler without Composer
On this page you can find all versions of the php package restruct/silverstripe-simpler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download restruct/silverstripe-simpler
More information about restruct/silverstripe-simpler
Files in restruct/silverstripe-simpler
Package silverstripe-simpler
Short Description Tries to make Silverstripe development a bit simpler by naively re-introducting some 'common sense'/old-fashioned/SS3 basics like global Bootstrap & jQuery and a modal
License MIT
Informations about the package silverstripe-simpler
Simpler Silverstripe
This module tries to make Silverstripe Admin interface development a bit simpler by naively re-introducting some traditional basics.
Added functionality, so far:
- 'Synthetic' JS load/unload events (
DOMNodesInserted
/DOMNodesRemoved
) for dynamic inserts/react components - (opt-in) Simple modal dialog (based on/requires additional loading of one JS file of ~260kb containing jQuery, VueJS & Bootstrap)
- Static Session::get etc accessors (just
require Restruct\Silverstripe\Simpler\Session
) instead of changing everything to $this->getRequest()->getSession()->etc
JS event for dynamically inserted & removed DOM nodes, even react components
(sort of what Entwine onmatch/onadd does, but without the polling and also working for react-rendered areas)
- To have your JS executed even when a form/fragment gets inserted from an Ajax/XHR request, listen for
DOMNodesInserted
- To remove/destroy JS stuff, listen for
DOMNodesRemoved
- The event object received by the handler contains an event.detail.type value:
LOAD
(regularDOMContenLoaded
, trigered once, always on document)XHR
(Ajax requests to /admin, triggered lots of times (), always on document)FETCH
(fetch requests to /admin, triggered lots of times () but not very reliably, always triggered on document)MOUNT
/UNMOUNT
(on mounting/unmounting of react form-components, triggered reliably & exactly once per mount/unmount, on the actual form element)
Example: FilePond
As a practical example, this module contains a 'compatibility layer' for the excelent FilePond module to also initialize filepond on dynamically inserted content (this code is already contained in this module, just copied here as an example of how the events work)
Opt-in extra JS requirement (~260kb), adds:
- (global) Bootstrap js (mainly for modal, but all-included)
- (global) $ & jQueery 3 (has to be slightly different indeed, as jquery is taken)
- even (global) VueJS 2 (I know, crazy!)
Modal dialog
Opening a simple modal dialog is a matter of setting some properties of the (again, global) simpler
object.
The modal dialog requires loading an additional JS file (of currently ~250kb) which adds jQuery 3, Bootstrap JS and VueJs 2 to your project:
Example of how the Restruct Shortcodable module opens the shortcode form dialog:
NOTES
- Check MutationObserver (& here) to use instead of React transformer fo the for the
DOMNodesXXX
events