|
|
@@ -315,20 +315,32 @@ class Zend_Form_Element implements Zend_Validate_Interface
|
|
|
|
|
|
$decorators = $this->getDecorators();
|
|
|
if (empty($decorators)) {
|
|
|
- $getId = create_function('$decorator',
|
|
|
- 'return $decorator->getElement()->getId()
|
|
|
- . "-element";');
|
|
|
$this->addDecorator('ViewHelper')
|
|
|
->addDecorator('Errors')
|
|
|
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
|
|
|
- ->addDecorator('HtmlTag', array('tag' => 'dd',
|
|
|
- 'id' => array('callback' => $getId)))
|
|
|
+ ->addDecorator('HtmlTag', array(
|
|
|
+ 'tag' => 'dd',
|
|
|
+ 'id' => array('callback' => array(get_class($this), 'resolveElementId'))
|
|
|
+ ))
|
|
|
->addDecorator('Label', array('tag' => 'dt'));
|
|
|
}
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Used to resolve and return an element ID
|
|
|
+ *
|
|
|
+ * Passed to the HtmlTag decorator as a callback in order to provide an ID.
|
|
|
+ *
|
|
|
+ * @param Zend_Form_Decorator_Interface $decorator
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public static function resolveElementId(Zend_Form_Decorator_Interface $decorator)
|
|
|
+ {
|
|
|
+ return $decorator->getElement()->getId() . '-element';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Set object state from options array
|
|
|
*
|
|
|
* @param array $options
|