2012-10-21 11 views

Odpowiedz

3

używam filtr niestandardowy zbyt i wewnątrz tego filtra można pobrać aktualny moduł:

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

W przeciwnym razie, można podać również wykluczone moduł wewnątrz pliku filters.yml:

customFilter: 
    class: customFilter 
    param: 
    module_excluded: moduleName 

i wewnątrz klasa:

<?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 
    } 
} 
+2

Świetnie, to działa dla mnie, ale są małe modyfikacje, aby ta współpraca de work ---> inside filters.yml ---> to "param:" nie "params:" –

+0

Masz rację, naprawiłem to. – j0k

Powiązane problemy