You need to be logged in to post in the forum - Log In
An active JCE Pro Subscription is required to post in the forum - Buy a Subscription
- Support
- Forum
- JCE Editor
- System plugin on J4 causes issue in JCE
Support is currently Offline
Official support hours:
Monday To Friday
From 09:00 To 17:00 Europe/London (BST)
From 09:00 To 17:00 Europe/London (BST)
Please post your question in the Forum and we will get back to you as soon as we can.
Hi! We have created a system plugin (Joomla 4, PHP 8.0) to manipulate the article title. We discovered that this system plgun causes issues when JCE is uploading a file. We get this error: "The server returned an invalid JSON response."
We can solve this issue by making a change to the system plugin:
function onContentBeforeSave($context, &$article, $isNew, $data)
When we remove the $data variable, there are no issues. So this $data variable is causing the upload issue.
I am not sure why this is happening. The system plugin should not affect the JCE file upl;oad. Correct?
in the Joomal docs I read this regarding the $data parameter of onContentBeforeSave:
+++++
data: The data to save. Note this data should be already validated by the extension. Since Joomla 3.7. Required to be set by extensions as of Joomla 4.0 as the core joomla content plugin uses this property
+++++
Any thoughts? Should I just leave the $data variable out or should JCE handle this differently?
Kind regards,
Jip
We can solve this issue by making a change to the system plugin:
function onContentBeforeSave($context, &$article, $isNew, $data)
When we remove the $data variable, there are no issues. So this $data variable is causing the upload issue.
I am not sure why this is happening. The system plugin should not affect the JCE file upl;oad. Correct?
in the Joomal docs I read this regarding the $data parameter of onContentBeforeSave:
+++++
data: The data to save. Note this data should be already validated by the extension. Since Joomla 3.7. Required to be set by extensions as of Joomla 4.0 as the core joomla content plugin uses this property
+++++
Any thoughts? Should I just leave the $data variable out or should JCE handle this differently?
Kind regards,
Jip
JCE triggers the onContentBeforeSave and onContentAfterSave events during a JCE file upload, so that the uploaded file can be manipulated by these events if required.
As the $data variable is new in Joomla 4, and is not used on the upload trigger, it is not included, which is what is causing the error.
Try adding it to the function with a default value, eg:
As the $data variable is new in Joomla 4, and is not used on the upload trigger, it is not included, which is what is causing the error.
Try adding it to the function with a default value, eg:
public function onContentBeforeSave($context, $item, $isNew, $data = array())
{
/* code */
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
JCE triggers the onContentBeforeSave and onContentAfterSave events during a JCE file upload, so that the uploaded file can be manipulated by these events if required.
As the $data variable is new in Joomla 4, and is not used on the upload trigger, it is not included, which is what is causing the error.
Try adding it to the function with a default value, eg:
As the $data variable is new in Joomla 4, and is not used on the upload trigger, it is not included, which is what is causing the error.
Try adding it to the function with a default value, eg:
public function onContentBeforeSave($context, $item, $isNew, $data = array())
{
/* code */
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Hi Ryan, yes that works. But I do wonder if maybe other extensions we will be using (in the future) will also cause issues when they don't use this variable. Should every extention (like JCE) that uses onContentBeforeSave create a $data variable or should plugin creators always use $data = array() to create this data varaible when it is not passed by the extenison?
Anyway, I al leat now know how and what. The system plugin works and JCE upload also. So thanks!
Anyway, I al leat now know how and what. The system plugin works and JCE upload also. So thanks!
Should every extention (like JCE) that uses onContentBeforeSave create a $data variable or should plugin creators always use $data = array() to create this data varaible when it is not passed by the extenison?
Fixed in the next update.
Just because you're not paranoid doesn't mean everybody isn't out to get you.
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!