?
avatar brainforgeUK
brainforgeUK
6 Feb 2018

Steps to reproduce the issue

Add debug code to function onContentPrepare in a plugin.
Display an article on site - event triggered OK
Display article edit form on administrator - event not triggered

Expected result

Expect onContentPrepare event to always be triggered in both site and administrator.

Actual result

onContentPrepare event not triggered in administrator (article editor)

System information (as much as possible)

Joomla 3.8.4

Additional comments

I want the change the <form ...> parameters from an event field plugin.
In particular I want to add enctype="multipart/form-data" .
I could do this with template overrides, but want to avoid touching them.

Looking at articles.php in administrator/components/com_content/views there appears to be no feature which would enable this (or other parameters) to be added the form without using the onContentPrepare event (on a field plugin). Rather than using the event to change the html produced it would be preferable if the field plugin could modify the form object to request this using another event (e.g. onContentPrepareForm).

avatar brainforgeUK brainforgeUK - open - 6 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 6 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Feb 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Feb 2018
Category com_plugins
avatar mbabker
mbabker - comment - 6 Feb 2018

I don't think we can have onContentPrepare run for the backend edit requests. This would cause a lot of issues because a lot of plugins are written in a way where this event is expected to run on the frontend only and altering the data could cause big problems.

For your particular case, to edit the rendered HTML for the <form> element you'd either need a template override or a plugin using the onAfterDispatch event as the layout markup wouldn't be passed to onContentPrepare anyway (you basically receive a processed database record in the event, not the full component rendering).

avatar brianteeman
brianteeman - comment - 6 Feb 2018

beat me to it. running oncontentprepare plgins in the admin would open a whole load of problems

avatar Bakual
Bakual - comment - 6 Feb 2018

Imho it's not in particular about site vs admin. But running it in edit context certainly doesn't work. It's not intended for that.

I'm closing this issue as that event by design isn't meant to be triggered while in edit context.

avatar Bakual Bakual - change - 6 Feb 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-02-06 19:02:11
Closed_By Bakual
avatar Bakual Bakual - close - 6 Feb 2018

Add a Comment

Login with GitHub to post a comment