dcylabs/symfony-twig-helper

一个帮助您在 Symfony 中处理权限的 Twig 扩展包

安装: 12

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:symfony-bundle

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 %}