ZF-5711: extraPlugins it's also a jsonParam in the Zend_Dojo_View_Helper_Editor

Description

In Zend_Dojo_View_Helper_Editor there is a protected property that handle (for the widget dijit.Editor) all the params (in this version captureEvents, events and plugins) that need to be parsed like JSON params in the generated zendDijits var, but a main property of the editor 'extraPlugins' doesn't appears.

Now:

protected $_jsonParams = array('captureEvents', 'events', 'plugins');

Expected:

protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins');

Comments

Patch for this issue.

The patch doesn't fix the issue on 1.9.2

But one can always set the extraPlugins as a string and not array: 'extraPlugins' => '[\'foreColor\', \'hilteColor\', \'createLink\', \'insertImage\']',

Well, don't fix the issue because was uploaded by apr.

put the extraPlugins as a string it's a way but not the best. The patch it's really simple:

  • protected $_jsonParams = array('captureEvents', 'events', 'plugins');
  • protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins');

suggested test unit, based on {{testHelperShouldJsonifyPlugins()}}:


public function testHelperShouldJsonifyExtraPlugins()
{
    $extraPlugins = array('copy', 'cut', 'paste');
    $html = $this->helper->editor('foo', '', array('extraPlugins' => $extraPlugins));
    $pluginsString = Zend_Json::encode($extraPlugins);
    $pluginsString = str_replace('"', "'", $pluginsString);
    $this->assertContains('extraPlugins="' . $pluginsString . '"', $html);
}

i hope it helps.

Unit test patch applied and view helper patched in trunk and 1.11 release branch.

Pull request for porting the patch in ZF2 is sent: https://github.com/zendframework/zf2/pull/309