2012-07-10 9 views
2

Zend_Form_Elment의 설명 장식 자 내에서 HTML을 사용할 수 있습니까? 예를 들어, 다음 문이 작동하지 않습니다Zend_Form_Element 설명 장식 자에서 HTML 사용

$number = new Zend_Form_Element_Text('number', array(
     'size' => 32, 
     'description' => 'Please the the following website: <a href="foo/bar">lorem ipsum</a>', 
     'max_length' => 100, 
     'label' => 'Number')); 

링크가 설명에 표시되지 않습니다, 괄호는 특수 문자 대응으로 변환됩니다.

링크를 표시하는 또 다른 방법이 있습니까 (아니면 HTML을 전혀 사용하지 않습니까?)?

답변

4

Description 데코레이터가 출력을 벗어나지 않도록 할 수 있습니다.

시도 :

$elementDecorators = array(
     'ViewHelper', 
     'Errors', 
     array('Description', array('class' => 'description', 'escape' => false)), 
     array('HtmlTag',  array('class' => 'form-div')), 
     array('Label',  array('class' => 'form-label', 'requiredSuffix' => '*')) 
); 

관련 부품의 존재 :

당신이 요소에 대한 장식의 자신의 세트를 만들 경우이 같은 장식을 구성 할 때

$number = new Zend_Form_Element_Text('number', array(
    'size'  => 32, 
    'description' => 'Please the the following website: <a href="foo/bar">lorem ipsum</a>', 
    'max_length' => 100, 
    'label'  => 'Number') 
); 

$number->getDecorator('Description')->setOption('escape', false); 

, 당신은 또한이 옵션을 지정할 수 있습니다

배열 ('설명', 배열 ('클래스'=> '설명', '도피'=> 거짓)),