[Zend Framework] Zend_Form: Zend_Form_Element とデコレータ

別件調査の副産物。

[markdown]

デフォルトのデコレータを登録するコード例。

“`
$date = new Zend_Form_Element_Text(‘text’);
$decorators = array(
array(‘ViewHelper’),
array(‘Errors’),
array(‘Description’, array(‘tag’ => ‘p’, ‘class’ => ‘description’)),
array(‘HtmlTag’, array(‘tag’ => ‘dd’)),
array(‘Label’, array(‘tag’ => ‘dt’)),
);
$date
->setDecorators($decorators)
->setLabel(‘Date’);
“`

> * [Zend_Form_Element を用いたフォーム要素の作成 – Zend_Form – Zend Framework](http://framework.zend.com/manual/1.12/ja/zend.form.elements.html#zend.form.elements.decorators)
> * [Zend Framework – Zend_Form編](http://doremi.s206.xrea.com/zend/ref/zend_form.html)
> * [Zend_Formをもっと触ってみる – @blog.justoneplanet.info](http://blog.justoneplanet.info/2010/07/24/zend_form%E3%82%92%E3%82%82%E3%81%A3%E3%81%A8%E8%A7%A6%E3%81%A3%E3%81%A6%E3%81%BF%E3%82%8B/)

[/markdown]