level51/silverstripe-payload-injector
最新稳定版本:0.1.5
Composer 安装命令:
composer require level51/silverstripe-payload-injector
包简介
Utility for injecting JSON payload into the DOM at render time.
README 文档
README
Utility for injecting JSON payload into the DOM at render time.
Requirements
- Silverstripe 4.x
Installation
composer require level51/silverstripe-payload-injector- Flush config (
flush=all) to register the middleware
Usage
If 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.
Config
Level51\PayloadInjector\PayloadInjector: merge_recursive: true # Merge payload recursively to avoid overriding existing data (default: true)
Maintainer
- Julian Scheuchenzuber js@lvl51.de
统计信息
- 总下载量: 1.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-18