hananils / kirby-snippetwhen-helper
当条件满足时,Kirby嵌入片段的辅助函数。
1.0.1
2021-11-18 13:00 UTC
Requires
README
snippetWhen 是一个为 Kirby 3 条件性嵌入片段的辅助函数。
安装
下载
下载并将此存储库复制到 /site/plugins/snippetwhen-helper
。
Git 子模块
git submodule add https://github.com/hananils/kirby-snippetwhen-helper.git site/plugins/snippetwhen-helper
Composer
composer require hananils/kirby-snippetwhen-helper
用法
snippetWhen($snippet, $condition, $expected, $data)
条件性嵌入片段
$snippet
: 片段名称$condition
: 评估为true
或false
的条件$expected
: 条件的预期结果,默认为true
$data
: 传递给片段的数据对象
snippetWhen('article', $page->category()->isNotEmpty());
许可证
此插件由 hana+nils · Büro für Gestaltung 在 MIT 许可证下免费提供。
我们为数字和模拟媒体创建视觉设计。