Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XTD Editor plugin produces an exception when you don't return an object or array #9316

Closed
yvesh opened this issue Mar 6, 2016 · 5 comments
Closed

Comments

@yvesh
Copy link
Member

yvesh commented Mar 6, 2016

Steps to reproduce the issue

Create a simple Editor XTD Plugin and call a page where an editor is displayed (like com_content edit)

class PlgButtonSample extends JPlugin
{
       public function onDisplay($name, $asset, $author)
    {
           // Can be also a string or boolean, it always breaks the jform
            return;
        }
}

Expected result

Nothing should be displayed

Actual result

An exception is thrown: (on getInput() where the plugins are loaded)

Call to a member function get() on null

System information (as much as possible)

Staging, php7

Additional comments

@wilsonge This is a regression and 3.5 blocker, as it is going to break any old editor plugins which does not return an array or object..

Probably related to b50885b

@yvesh yvesh changed the title XTD Editor plugin breaks when you don't return an object or array XTD Editor plugin produces an exception when you don't return an object or array Mar 6, 2016
@infograf768
Copy link
Member

@nonumber
Please look

yvesh referenced this issue Mar 6, 2016
This creates the ability for an editor-xtd plugin to return an array of buttons, instead of just one button object.

### Testing
To test, replace this code in
/plugins/editors-xtd/readmore/readmore.php
```
return $button;
```

with:
```
		$button2 = new JObject;
		$button2->modal = false;
		$button2->class = 'btn';
		$button2->onclick = 'alert("Hurray!");return false;';
		$button2->text = 'An extra button!';
		$button2->name = 'smiley-2';
		$button2->link = '#';

		return array($button, $button2);
```
@ghost ghost mentioned this issue Mar 6, 2016
@ghost
Copy link

ghost commented Mar 6, 2016

This should fix it: #9317

@infograf768
Copy link
Member

@yvesh

Please test #9317

@yvesh
Copy link
Member Author

yvesh commented Mar 6, 2016

@infograf768
Done, #9317 fixes it

wilsonge added a commit that referenced this issue Mar 6, 2016
@brianteeman
Copy link
Contributor

Closed as #9317 has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants