Search
Other Content Templater questions
Forum

Updated JCE to 2.8.0 today. Error with templater

Chuck's Avatar Chuck
I updated today and found that the error:
0 Call to a member function get() on array
when I tried to open an article after update. I posted in Reg./ labs forum and told me it was an xtd-button. I isolated it to this extension. I wanted you to be aware of this issue.
Peter van Westen's Avatar Peter van Westen ADMIN
I cannot reproduce the issue. All working fine for me with JCE 2.8.
Try clearing your browser cache and cookies.
Please post a rating at the Joomla! Extensions Directory
Patrick Jackson's Avatar Patrick Jackson
Peter,

I've today had a similar issue to Chuck, with more luck on finding a solution. Content Templater v8.5.4 is the version I've been using. (Joomla 3.9.22, JCE 2.9.1)

I was able to isolate through elimination "Call to a member function get() on array" being caused by Content Templater extended editor plugin. Working my way through troubleshooting, I found that in my case it's due to the button array being returned by PlgButtonContentTemplaterHelper->render when the editor name is not a default object.

So the button appeared fine when I was editing an article or other core content, or in other components that appear to have the right trigger for displaying extended fields under the editor block.

The error I receive is when I go to load the editor on some other extensions - in today's case specifically JoomlaLMS.

If I modify line 99 in plugins/editor-xtd/contenttemplater/helper.php and change:
return $buttons;
to
return $button;
the error goes away, and functionality is restored as the array being returned is just a single array of values, and not an array itself.

Though your plugin seems to work in most cases, looking at JoomlaLMS code, they modify the button array to put some other things in, and leave some options out. However, when I display the arrays in question for all the plugins that load, only the contenttemplater one has the array in an array.

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
That is because Content Templater potentially creates multiple buttons.
But this error only happens with JCE?
Then shouldn't you be reporting this to JCE and let them have it fixed on their side?
Please post a rating at the Joomla! Extensions Directory
Patrick Jackson's Avatar Patrick Jackson
Error only occurred actually with JoomlaLMS - it did the same when switching to TinyMCE too.

Reporting it to JoomlaLMS as I think it's their code that's inefficient and doesn't take into account the fact that an array can be returned for multiple buttons from a single plugin.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription