ZF-12175: Decorator_UiWidgetContainer does not render content passed from previous decorator
Description
Following code silently ignores content passed from previous decorator (stored in $content)
public function render($content)
{
$element = $this->getElement();
$view = $element->getView();
if (null === $view) {
return $content;
}
$jQueryParams = $this->getJQueryParams();
$attribs = $this->getOptions();
$helper = $this->getHelper();
$id = $element->getId() . '-container';
return $view->$helper($id, $jQueryParams, $attribs);
}
When used like this (http://framework.zend.com/manual/en/…)
$form->setDecorators(array(
'FormElements',
array('TabContainer', array(
'id' => 'tabContainer',
'style' => 'width: 600px;',
)),
'Form',
));
it may not matter - you simply use {{FormElements}} decorator to render sub-forms with TabPane decorator. But suppose that the master form (not sub-form) had some elements like buttons that one want to be common regardles of the choosen pane? This elements were added but are not rendered at all. I think {{ZendX_JQuery_Form_Decorator_UiWidgetContainer::render}} should look like this:
public function render($content)
{
$element = $this->getElement();
$view = $element->getView();
if (null === $view) {
return $content;
}
$placement = $this->getPlacement();
$separator = $this->getSeparator();
$jQueryParams = $this->getJQueryParams();
$attribs = $this->getOptions();
$helper = $this->getHelper();
$id = $element->getId() . '-container';
$tabs = $view->$helper($id, $jQueryParams, $attribs);
switch ($placement) {
case self::PREPEND:
return $tabs . $separator . $content;
case self::APPEND:
return $content . $separator . $tabs;
}
If developer added some elements to the form than I assume he wanted them to be rendered...
Comments
Posted by Frank Brückner (frosch) on 2012-04-27T07:17:13.000+0000
Patch and unit test added.
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-31T22:55:17.000+0000
Applied patch and ran tests...all appears OK. However, my SVN access doesn't extend to the extras repo, so someone else will have to commit
Posted by Rob Allen (rob) on 2012-06-13T20:37:48.000+0000
Fixed in svn r24955.
Adam: you now have rw access.