bravesheep/active-link-bundle

此包已被废弃且不再维护。未建议替代包。

提供在 Twig 模板中判断是否请求了动作的能力

v0.1.0 2014-07-16 14:26 UTC

This package is auto-updated.

Last update: 2023-03-25 20:52:47 UTC


README

此捆绑包提供了一些 Twig 辅助函数和过滤器,用于检查控制器的特定部分是否处于活动状态。

请注意,有些限制,特别是此捆绑包与子请求不兼容。相反,捆绑包始终请求主请求。

安装

使用 Composer 将捆绑包添加到需求中

{
    "require": {
        "bravesheep/active-link-bundle": "dev-master"
    }
}

然后运行 composer update bravesheep/active-link-bundle。最后在 app/AppKernel.php 中添加捆绑包

public function registerBundles()
{
    return array(
        // ...
        new Bravesheep\ActiveLinkBundle\BravesheepActiveLinkBundle(),
        // ...
    );
}

可用的 twig 函数

  • active(location[, params])
  • active_route(route[, params])
  • active_bundle(bundle[, params])
  • active_controller(controller[, params])
  • active_action(action[, params])

可用的 twig 过滤器

  • location is active([params])
  • route is active_route([params])
  • bundle is active_bundle([params])
  • controller is active_controller([params])
  • action is active_action([params])