tôi sử dụng bộ lọc tùy chỉnh quá và bên trong bộ lọc này bạn có thể lấy các module hiện tại:
<?php
class customFilter extends sfFilter
{
public function execute ($filterChain)
{
$context = $this->getContext();
if ('moduleName' == $context->getModuleName())
{
// jump to the next filter
return $filterChain->execute();
}
// other stuff
}
}
Nếu không, bạn cũng có thể cung cấp cho các mô-đun loại trừ bên trong filters.yml
file:
customFilter:
class: customFilter
param:
module_excluded: moduleName
Và bên trong lớp học:
<?php
class customFilter extends sfFilter
{
public function execute ($filterChain)
{
$context = $this->getContext();
if ($this->getParameter('module_excluded') == $context->getModuleName())
{
// jump to the next filter
return $filterChain->execute();
}
// other stuff
}
}
Tuyệt vời, điều đó phù hợp với tôi nhưng có một chút sửa đổi để thực hiện việc này de công việc ---> bên trong filters.yml ---> đó là "param:" không "params:" –
Bạn nói đúng, tôi đã sửa nó. – j0k