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

Issue Type: Bug Created: 2011-01-17T14:37:09.000+0000 Last Updated: 2011-07-28T19:34:04.000+0000 Status: Resolved Fix version(s): - 1.11.6 (05/May/11)

Reporter: Silver Zachara (snop) Assignee: Robert Basic (robertbasic) Tags: - Zend_Dojo

Related issues: - ZF-7845

Attachments: - ZF-10960-tests.diff



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:

<pre class="highlight">
        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:

<pre class="highlight">
        $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'   => '/<br></br>/i',
                        'replace' => ''

And here is the patch:

<pre class="highlight">
     * 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:

<pre class="highlight">
        if (in_array($plugin, $plugins)) {


<pre class="highlight">
        if (in_array($plugin, $plugins) && ($plugin !== '|')) {

Thank you for the fix in next ZF release.


Posted by Robert Basic (robertbasic) on 2011-04-22T11:12:26.000+0000

Bug confirmed and attaching the patch as per the description.

Posted by Robert Basic (robertbasic) on 2011-04-22T15:02:03.000+0000

Attaching tests.

Posted by Ralph Schindler (ralph) on 2011-04-28T17:49:12.000+0000

Fixed in r23873 in trunk and r23874 in release branch 1.11

Posted by Robert Basic (robertbasic) on 2011-07-28T19:34:03.000+0000

Pull request to import the patch to ZF2 is sent

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.