开发者

enable Dojo support for Forms just on demand in Zend Framework

开发者 https://www.devze.com 2022-12-23 05:51 出处:网络
How to have Dojo support disabled by default and just enable it if you want to use it ? I have the problem that dojo support is automaticly loaded when using any form.

How to have Dojo support disabled by default and just enable it if you want to use it ?

I have the problem that dojo support is automaticly loaded when using any form. Even without any dojo elements.

I have following configuration:

Bootstrap file

    if($this->dojo()->isEnabled()){

$this->dojo()->setLocalPath($this->baseUrl().'/js/dojo/dojo/dojo.js') ->addStyleSheetModule('dijit.开发者_如何转开发themes.tundra') ->setDjConfigOption('usePlainJson',true); echo $this->dojo();}

I thought to enable dojo I had to use explicit use something like this in my template/view file:

 $this->dojo()->enable();

How the tell Zend Framework not to use Dojo by default for Forms ?


<?php
  if ($this->dojo()->isEnabled())
  {
   $this->dojo()
                    ...
   echo $this->dojo();
  }
 ?>

Prints the the javascript required to enable dojo if it is enabled. I tend to put this in my layout script,.

I add the dojo as a view helper in the bootstrap inside _initViewHelpers()

$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');

Then enable as required in the controller

 $this->view->dojo()->enable();

If you use a standard Zend_Form with no Dojo elements Dojo shouldn't be loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号