2013-08-07 4 views
0

다른 기능의 필터를 다른 필터로 필터링하려면 어떻게해야합니까? 예를 들어,이 같은 것을 할 수있는 나뭇 가지 템플릿에서 내 영어나뭇 가지 통화의 필터

답변

0

에 대한

public function getFilters() 
     { 

         return array (
             'test' => new \ Twig_Filter_Method ($this, 'test'), 
             'test1' => new \ Twig_Filter_Method ($this, 'test1', array('is_safe' => array('html'))) 
        ); 
     } 


public function test($test) 
{ 
    return; 
} 


public function test1($test) 
{ 
    // how to test call? 
} 

감사와 죄송합니다 : 당신이 정기적으로 PHP는 객체의 기능처럼 test 함수를 호출 할 수 있습니다

{{ 'Some string'|test|test1('argument')}} 

나뭇 가지 확장 클래스 내부를 :

public function test1($test) 
{ 
    // your code 
    $testResult = $this->test($test); 
}