I'm developing a new Joomla component where I have a JAdminForm
called course.xml
. This form has several text fields / text areas that will contain meta titles / tags for an item.
However, when submitted and saved to the database, I want to JSON encode these metadata fields for storage in a single database column, metadata
. Similarly, when the form loads I'd like to JSON decode these out into their respective form fields for (re)editing.
There seems to be a few different approaches to solve this:
- Override
JControllerForm
save()
/bind()
- Override
JModelAdmin
save()
- Use plugin events like
onContentPrepareForm
My gut feeling is that I'd rather override than use plugins (seems like a sledgehammer cracking a nut), but looking to see what is 'standard'. This also seems like it'd be a fairly common use case (where the XML form used by JForm doesn't exactly match the database), but I can't find a definitive resource on how to approach / implement.