I'm try to create a system plugin with Joomla 4. Its purpose is adding a new field (pippo) in the article editing form and save its value in the attribs column of the content table.

I used the "onContentPrepareForm" event. The field is displayed correctly in the metadata section of the article but it is not stored into the content table.

This is the function of the plugin:

public function onContentPrepareForm($form, $data)
    $doc = $this->app->getDocument();

    if ((!$this->app->isClient('administrator')) && ($doc->getType() != 'html')) return;

    if ((JFactory::getApplication()->input->get('option') == 'com_content') && 
        (JFactory::getApplication()->input->get('view') == 'article') &&
        (JFactory::getApplication()->input->get('layout') == 'edit')) {
        $form->loadFile('article', false);

And this is the XML of the field:

<?xml version="1.0" encoding="utf-8"?>
    <fields name="attribs">
        <fieldset name="jmetadata" label="PLG_SYSTEM_PIPPO_LABEL_TEXT">
            <field name="pippo" type="text" size="50" label="PLG_SYSTEM_PIPPO_LABEL_TEXT" placeholder="PLG_SYSTEM_PIPPO_PLACEHOLDER"/>

I remember in Joomla 3 this is the way to go. But in Joomla 4... What's wrong?

Thanks in advance


Changed this:


with this:


and it works!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.