Issues

ZF-12175: Decorator_UiWidgetContainer does not render content passed from previous decorator

Issue Type: Bug Created: 2012-04-26T15:03:41.000+0000 Last Updated: 2012-06-13T20:37:48.000+0000 Status: Resolved Fix version(s): - 1.11.12 (22/Jun/12)

Reporter: Przemys?aw Wróbel (wrobel) Assignee: Frank Brückner (frosch) Tags: - ZendX_JQuery

  • FixForZF1.12
  • zf-crteam-review

Related issues: Attachments: - Form.patch

Description

Following code silently ignores content passed from previous decorator (stored in $content)

<pre class="highlight">
    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/…)

<pre class="highlight">
$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:

<pre class="highlight">
    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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts