Utility for injecting JSON payload into the DOM at render time.
Utility for injecting JSON payload into the DOM at render time.
composer require level51/silverstripe-payload-injector
flush=all
) to register the middlewareIf you do...
public function index() {
PayloadInjector::singleton()->stage([
'title' => 'Silverstripe Payload Injector',
'description' => 'Utility for injecting JSON payload into the DOM at render time.'
]);
return $this->renderWidth('MainView');
}
...in a controller you will have...
...
<script>window.payload = {"title":"Silverstripe Payload Injector","description":"Utility for injecting JSON payload into the DOM at render time."}</script>
</body>
</html>
...in your template.
Level51\PayloadInjector\PayloadInjector:
merge_recursive: true # Merge payload recursively to avoid overriding existing data (default: true)
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem