2012-10-21 18 views

cevap

3

Ben de özel filtre kullanmak ve bu filtrenin içine geçerli modülünü alabilirsiniz:

customFilter: 
    class: customFilter 
    param: 
    module_excluded: moduleName 

Ve içeride: Aksi

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

, ayrıca filters.yml dosyasının içinde dışlanan modülünü verebilir Sınıfı:

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

Harika, bu benim için çalışıyor, ancak bu işbirliği için küçük değişiklikler var. de work ---> içindeki filters.yml ---> bu "param:" değil "params:" –

+0

Haklısın, düzeltdim. – j0k

İlgili konular