Issues

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

Patch and unit test added.

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

Fixed in svn r24955.

Adam: you now have rw access.