Issues

ZF-7890: Add ability to specify a rootnode type for customDijit's

Description

Currently, there doesn't appear to be a way to specify which type of root node will be used for instantiating a customDijit. I believe the default is a

<

div>, but for semantic reasons it might be better to specify a custom element type to ensure a page could degrade gracefully.

My example would be a custom multiselect from dojox. It doesn't require a element to be the root, but

isn't valid markup and could have unpredictable results (nor would it degrade). (Note: the issue doesn't exist if you are using a datastore with this widget, as all markup instantiation is done for you, but the overall implication would suggest having a root node setting would be best, hence this ticket)

Comments

You can now pass 'rootNode' as one of the params to a customDijit; ability added in trunk and merged to 1.9 release branch.

The parameter 'rootNode' is only accepted when using customDijit without capture.


<?php echo $this->customDijit()->captureStart(
    'foo',
    array(
        'dojoType' => 'dijit.layout.AccordionPane',
        'title'    => 'Not accepting root node in customDijit capture.',
        'rootNode' => 'h2'
    ),
    array(
        'rootNode' => 'h2'
    )
); ?>
Not accepting root node in customDijit capture.
<?php echo $this->customDijit()->captureEnd('foo'); ?>

<?php echo $this->accordionPane()->captureStart(
    'foo2',
    array(
        'dojoType' => 'dijit.layout.AccordionPane',
        'title'    => 'Not accepting root node in accordionPane capture.',
        'rootNode' => 'h2'
    ),
    array(
        'rootNode' => 'h2'
    )
); ?>
Not accepting root node in accordionPane capture.
<?php echo $this->accordionPane()->captureEnd('foo2'); ?>

<?php echo $this->customDijit(
    'bar',
    'Accepting root node.',
    array(
        'dojoType' => 'dijit.layout.AccordionPane',
        'title'    => 'Accepting root node.',
        'rootNode' => 'h2'
    )
); ?>

<?php echo $this->accordionPane(
    'bar2',
    'Not accepting root node in accordionPane.',
    array(
        'title'    => 'Not accepting root node in accordionPane.',
        'rootNode' => 'h2'
    ),
    array(
        'style' => 'background-color: lightgray;',
        'title'    => 'Not accepting root node in accordionPane.',
        'rootNode' => 'h2'
    )
); ?>

HTML Result:


Not accepting root node in customDijit capture.
Not accepting root node in accordionPane capture.

Accepting root node.

Not accepting root node in accordionPane.

The 'h2' node is never set on the other examples no matter where you put it. The result is the same when using dojo declarative or programmatic mode.

It would be really great if existin view helpers like 'accordionPane' would also accept the 'rootNode' parameter.

I guess the following customDijit lines should then be passed to Zend_Dojo_View_Helper_DijitContainer:


        if (array_key_exists('rootNode', $params)) {
            $this->setRootNode($params['rootNode']);
            unset($params['rootNode']);
        }