The only way I can think of at the moment is to add a dummy element to the form and remove all decorators except an 'HtmlTag' with the attributes you specified in your question. Removing the decorators means that the actual element will not be rendered - only the HtmlTag decorator will be rendered.
so assuming your form is $form:
$form->addElement(
'hidden',
'dummy',
array(
'required' => false,
'ignore' => true,
'autoInsertNotEmptyValidator' => false,
'decorators' => array(
array(
'HtmlTag', array(
'tag' => 'div',
'id' => 'wmd-button-bar',
'class' => 'wmd-panel'
)
)
)
)
);
$form->dummy->clearValidators();
Note that you want to prevent any validation of the element. This is only one way - there are likely others.
Output:
<div id="wmd-button-bar" class="wmd-panel"></div>
There is a good article describing decorators.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…