mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
DOCS: Add YAML example for including extra JS in the CMS
This commit is contained in:
parent
dca2d47127
commit
554c34eff7
@ -136,8 +136,13 @@ extras.
|
||||
Continuing our example let's add a "constructive" style to our *Clean-up* button. First you need to be able to add
|
||||
custom JS code into the CMS. You can do this by adding a new source file, here
|
||||
`app/javascript/CMSMain.CustomActionsExtension.js`, and requiring it
|
||||
through a YAML configuration value: `LeftAndMain.extra_requirements_javascript`.
|
||||
Set it to 'app/javascript/CMSMain.CustomActionsExtension.js'.
|
||||
through a YAML configuration value:
|
||||
|
||||
```yml
|
||||
SilverStripe\Admin\LeftAndMain:
|
||||
extra_requirements_javascript:
|
||||
- app/javascript/CMSMain.CustomActionsExtension.js
|
||||
```
|
||||
|
||||
You can now add the styling in response to `afterrefreshalternate` event. Let's use entwine to avoid accidental memory
|
||||
leaks. The only complex part here is how the entwine handle is constructed. `onbuttonafterrefreshalternate` can be
|
||||
|
Loading…
x
Reference in New Issue
Block a user