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
Expect onContentPrepare event to always be triggered in both site and administrator.
onContentPrepare event not triggered in administrator (article editor)
Joomla 3.8.4
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).
Labels |
Added:
?
|
Category | ⇒ | com_plugins |
beat me to it. running oncontentprepare plgins in the admin would open a whole load of problems
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.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-06 19:02:11 |
Closed_By | ⇒ | Bakual |
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 theonAfterDispatch
event as the layout markup wouldn't be passed toonContentPrepare
anyway (you basically receive a processed database record in the event, not the full component rendering).