basaltinc/twig-tools
最新稳定版本:v1.4.3
Composer 安装命令:
composer require basaltinc/twig-tools
包简介
README 文档
README
composer require basaltinc/twig-tools
Twig Functions
get_data( path )
Takes the path to a .json, .yml, or .yaml file and returns the data for use in Twig.
Parameters
path{string} Either absolute path, relative path from CWD, or Twig Namespace path like@namespace/file.json.
Example
{% set schema = get_data('@namespace/foobar.schema.yml') %}
validate_data_schema( path, _self )
Takes the path to a .json, .yml, or .yaml data schema file and validates the data being used by the twig template file in which the validate function is included. As a standard, this should be the last thing included in a twig template file.
Parameters
path{string} Either absolute path, relative path from CWD, or Twig Namespace path like@bolt-components-foo/foo.schema.json.
Example
{{ validate_data_schema('@namesapce/foobar.schema.yml', _self) }}
console_log( data )
Outputs data to the browser's console log.
Parameters
dataAny data you would like to log to the console from a twig template.
Example
{{ console_log(page.meta) }}
统计信息
- 总下载量: 348.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-09