ZF-10960: Zend_Dojo_Form_Element_Editor doesn't accept more than one separator ( char | ) in toolbar



I discovered bug in Zend_Dojo_Form_Element_Editor in function addPlugin(). When I try add more than one separator in dijit.Editor toolbar, so only one separator will be added, because this condition:

        if (in_array($plugin, $plugins)) {
            return $this;

So, when in the $plugin variable is the string | ( it's the separator for dijit.Editor toolbar ), so the next separator will not be added into the dijit.Editor toolbar.

Here is the example, in ->setPlugins() is more than one separator ( e.g. 'undo', 'redo', '|', 'copy', 'cut', '|', 'bold', '|', 'createLink' ), so there are 3 separators '|', but in dijit.Editor toolbar is displayed only one separator:

        $introtext = new Zend_Dojo_Form_Element_Editor('introtext');
            ->setLabel('Popis k Up├║tavke:')
                'undo', 'redo', '|', 'copy', 'cut', 'paste', '|', 'bold', 'italic', 'underline', 'strikethrough', '|',
                'createLink', 'dijit._editor.plugins.LinkDialog', 'dijit._editor.plugins.EnterKeyHandling'
                new Zend_Validate_StringLength(
                        'max' => 255
                new Zend_Filter_PregReplace(
                        'match'   => '/
/i', 'replace' => '' ) ) ));

And here is the patch:

     * Add a single editor plugin
     * @param  string $plugin
     * @return Zend_Dojo_Form_Element_Editor
    public function addPlugin($plugin)
        $plugin = (string) $plugin;
        $plugins = $this->getPlugins();
        if (in_array($plugin, $plugins) && ($plugin !== '|')) {
            return $this;

        $plugins[] = (string) $plugin;
        $this->setDijitParam('plugins', $plugins);
        return $this;

In this patch is changed this line, from:

        if (in_array($plugin, $plugins)) {


        if (in_array($plugin, $plugins) && ($plugin !== '|')) {

Thank you for the fix in next ZF release.


Bug confirmed and attaching the patch as per the description.

Attaching tests.

Fixed in r23873 in trunk and r23874 in release branch 1.11

Pull request to import the patch to ZF2 is sent https://github.com/zendframework/zf2/pull/289