View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Dojo Arbitrary Dijit Support - Matthew Weier O'Phinney
{zone-data}

{zone-data:proposer-list}
[~matthew]
{zone-data}

{zone-data:liaison}
[~ralph]
{zone-data}

{zone-data:revision}
1.0 - 14 January 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Dojo provides scaffolding for the Dojo environment, as well as view helpers and form support for a variety of Dijits. One key feature of Dojo is the ability to define your own dijits as well as to extend existing dijits. This goal of this proposal is to provide a view helper that can be used to generate markup and/or javascript for arbitrary dijits, as well as clearly define how to create view helpers to support your own dijits.
{zone-data}

{zone-data:references}
* [Widget creation tutorial|http://docs.dojocampus.org/quickstart/writingWidgets]
* [Zend_Dojo documentation|http://framework.zend.com/manual/en/zend.dojo.html]
{zone-data}

{zone-data:requirements}
* This proposal *will* define a generic view helper for generating arbitrary Dijit markup and/or javascript
* This proposal *will* result in documentation on how to create view helpers to support custom Dijits.
{zone-data}

{zone-data:dependencies}
* Zend_Dojo
{zone-data}

{zone-data:operation}
Zend_Dojo view helpers already have a standard signature:
{code}
string helperName(string $id, string $content, array $params, array $attribs)
{code}
where $params defines Dijit-specific parameters, and $attribs defines HTML attributes to be included in markup. $content may be ignored depending on the dijit.

Additionally, layout container dijits allow you to return the helper instance in order to perform tasks such as capturing content or adding sub items:
{code}
Zend_Dojo_View_Helper_Dijit helperName()
{code}

The generic dijit view helper that will be created with this proposal will come in two flavors: dijit and container. These will follow the above signatures, and allow the developer to use arbitrary dijit types. The only difference in calling is that the $params member 'dojoType' *must* be specified; this will be used to ensure that the appropriate dojo.require statement is called and that the dijit type is associated with the markup and/or javascript generated. Additionally, an optional $params member, 'displayType', will be used to indicate if the dijit is rendered as a "block" (which will render a <div> by default) or as an "inline" element (rendered as a <span> by default); "block" will be the default. Finally, the tag to use for rendering may be specified using the "tagType" $params member.
{zone-data}

{zone-data:milestones}
* Milestone 1: Create proposal and submit for review
* Milestone 2: Create working prototypes, including unit tests, of generic dijit view helpers
* Milestone 3: Document generic dijit view helpers
* Milestone 4: Create documentation indicating how to create new dijit view helpers for custom dijits
{zone-data}

{zone-data:class-list}
* Zend_Dojo_View_Helper_CustomDijit
* Zend_Dojo_View_Helper_CustomDijitContainer
{zone-data}

{zone-data:use-cases}
||UC-01||
h4. Rendering a custom dijit
{code:php}
$this->customDijit('foo', $content, array(
'dojoType' => 'custom.Foo',
'displayType' => 'inline',
));
{code}

||UC-02||
h4. Rendering a custom container dijit
{code:php}
<?php
$this->customDijitContainer()->captureStart('foo', array('dojoType' => 'custom.Foo'));
?><p>This is some content to be captured.</p><?php
echo $this->customDijitContainer()->captureEnd('foo'); ?>
{code}
{zone-data}

{zone-data:skeletons}
TBD; will mimic existing dijit support
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>