2011年2月10日星期四

Re: [fw-mvc] Dojo resource feature request

-- Nathan Garlington <garlinto@gmail.com> wrote
(on Wednesday, 09 February 2011, 09:14 PM -0700):
> In the class Zend_Application_Resource_Dojo that ships in dojo, the
> following public method is exposed:
>
> public function getDojo()
> {
> if (null === $this->_dojo) {
> $this->getBootstrap()->bootstrap('view');
> $view = $this->getBootstrap()->view;
>
> Zend_Dojo::enableView($view);
> $view->dojo()->setOptions($this->getOptions());
>
> $this->_dojo = $view->dojo();
> }
>
> return $this->_dojo;
> }
>
> I know I can create my own dojo resource that can consume a custom view
> object, but I was wondering if this method could be changed to allow setting
> the view object to a custom view object in application.ini?
>
> Something like:
>
> resources.dojo.enable = true
> resources.dojo.view = "myView"
> ; more config options.....

This would then set a separate view object for the Dojo view helper than
you use for the rest of the application. I'm not sure it makes any
sense, to be honest.

Create an alternate View resource -- the code provided will use
whatever view resource is registered, which I think is more in line with
what you might want to achieve.

> Then, in Zend_Application_Resource_Dojo, something like:
>
> public function getDojo()
> {
> if (null === $this->_dojo) {
> $options = $this->getOptions();
> if ($options['view']) {
> $this->getBootstrap()->bootstrap($options['view']);
> $view = $this->getBootstrap()->$options['view'];
> } else {
> $this->getBootstrap()->bootstrap('view');
> $view = $this->getBootstrap()->view;
> }
>
> unset($options['view']);
>
> Zend_Dojo::enableView($view);
> $view->dojo()->setOptions($options);
>
> $this->_dojo = $view->dojo();
> }
>
> return $this->_dojo;
> }
>
> The above is just an idea. Would a change like this be in keeping with the
> goals of the vanilla resources shipped with ZF, or should I just plan on
> creating my own dojo resource? If this is something the devs would approve,
> how do I go about submitting the idea?
>
> --regards,
> nathan

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

没有评论: