dcylabs / symfony-twig-helper
一个帮助您在 Symfony 中处理权限的 Twig 扩展包
dev-master
2016-03-14 18:35 UTC
This package is not auto-updated.
Last update: 2024-09-26 00:42:16 UTC
README
更新 composer.json
composer require dcylabs/symfony-twig-helper dev-master
或者
"require": { "dcylabs/symfony-twig-helper": "dev-master" }
更新 AppKernel.php
// app/AppKernel.php $bundles = array( // ... new Dcylabs\TwigBundle\DcylabsTwigBundle(), );
使用 Dcylabs Twig 扩展包
检查角色
{% checkRoles '/myPath' %}
If I can read this I have the rights on the url : "{{ check_url }}"
{% else %}
I don't have the rights
{% endcheckRoles %}
{% checkRoles '/pathOne' '/pathTwo' '/pathThree' %}
If I can read this I have the rights on the urls : "{{ check_urls | join(';') }}"
{% else %}
I don't have the rights
{% endcheckRoles %}