Joomla article edit, customfield

1k Views Asked by At

I have searched around a lot but I don't find any good information how too add a custom field to Joomla article (com_content&view=edit). Just how you hack Joomla's core files to add own fields but its not an alternative for me.

I think the best way to do it is to create a own plugin, but im stuck here. I have created a plugin into group "system" but my plugins doesn't get triggered.

Does anyone know how I can solve this on a good way?

My plugin customfield.php:

<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

class plgSystemCustomField extends JPlugin {

    function onContentPrepareForm($form, $data)
    {
        echo "Trigger 1???";
        if($form->getName() == 'com_content.article') {
            JForm::addFormPath(dirname(__FILE__).'/form');
            $form->loadFile('customfield', false);
            print_r($form);
        }
        return true;
    }

    function onDisplay() {
        echo "Trigger 2???";
    }           
}
1

There are 1 best solutions below

2
On

One of Joomla's major weaknesses is the difficulty of adding custom fields. There are numerous discussions about this in various Joomla forums. Although it's not easy, the current solution is to use one of the "CCKs" or advanced form extensions, such as these: http://extensions.joomla.org/extensions/authoring-a-content/content-construction