不知道這是否是可能的標籤,我想你將不得不重寫標籤元素是如何的形式呈現。我只是設法以相同的使用說明標籤:
<div class="input-group input-group-sm col-md-12">
<span class="input-group-addon">Name of the field</span>
<input id="name" class="form-control" type="text" name="name">
</div>
這是通過使用裝飾像做:
public $inputDecorators_md12 = array(
'ViewHelper',
array('Description', array('escape' => false, 'tag' => 'span', 'placement' => 'prepend', 'class'=>'input-group-addon')),
array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'input-group input-group-sm col-md-12'))
);
請注意,您可以定義要用於描述任何類型的標籤。
所以不是
$field->setLabel('fieldlabel')
你可以這樣做:
$field->setDescription('fieldlabel')
->setDecorators($this->inputDecorators_md12);
哪個版本您正在ZF的? – 2013-04-23 10:31:57
我正在使用v1.12 – setrul 2013-04-23 10:36:51
chandresh_cool的答案應該可以工作。請你可以編輯你的問題,包括你的裝飾器代碼基於這個答案,它正在生產的HTML – 2013-04-23 11:41:31