hananils/kirby-snippetwhen-helper
Composer 安装命令:
composer require hananils/kirby-snippetwhen-helper
包简介
Helper function for Kirby to embed snippets only when a condition is met.
README 文档
README
snippetWhen is a helper function for Kirby 3 to conditionally embed snippets.
Note
Please check out the online documentation at kirby.hananils.de/plugins/snippetwhen-helper for further information.
Installation
Download
Download and copy this repository to /site/plugins/snippetwhen-helper.
Git submodule
git submodule add https://github.com/hananils/kirby-snippetwhen-helper.git site/plugins/snippetwhen-helper
Composer
composer require hananils/kirby-snippetwhen-helper
Usage
snippetWhen($snippet, $condition, $expected, $data)
Conditionally embeds a snippet:
$snippet: the name of the snippet$condition: a condition that either evaluates totrueorfalse$expected: the expected result of the condition, defaults totrue$data: data object passed to the snippet
snippetWhen('article', $page->category()->isNotEmpty());
License
This plugin is provided freely under the MIT license by hana+nils · Büro für Gestaltung.
We create visual designs for digital and analog media.
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-23
