1

i am making a simple content plugin using the joomla 3 docs.

However i want more than 1 tab to appear.

here are my main files. Plugin is installed an runs succesfully but only one tab will ever appear.

extras.php

// no direct access
defined ( '_JEXEC' ) or die ( 'Restricted access' );
class plgContentExtras extends JPlugin {

// the language file would have to go into languages folder

        protected $autoloadLanguage = true;

        function onContentPrepareForm($form, $data) {
                $app = JFactory::getApplication();
                $option = $app->input->get('option');
                switch($option) {
                        case 'com_content':
                                if ($app->isAdmin()) {

                                        JForm::addFormPath(__DIR__ . '/forms');
                                        $form->loadFile('extras', true);

                                }                           

                                return true;
                }
                return true;
        }
}

forms/extras.xml

<?xml version="1.0" encoding="UTF-8"?>
<form>
        <fields name="params">
                <fieldset name="params"  label="Map" >
                        <field
                                name="mapinfo"
                                type="text"
                                label="Map Info"
                                />

                </fieldset>

                <fieldset name="params"  label="eBlast" >
                        <field
                                name="eblastinfo"
                                type="text"
                                label="Eblast Info"
                                />

                </fieldset>

        </fields>   

</form>

Thanks to anyone in advance for your help :)

ps: i am a novice to this.

I did also try adding an extra $form->loadFile('eblast', true); to the extras.php file and then creating an extra file called eblast.xml within the forms/ folder but that didnt work either.

1 Answer 1

1

This is because you have assigned the same name to both <fieldset> tags. Each one must have a different name, for example:

<fieldset name="map" label="Map">
    <field
        name="mapinfo"
        type="text"
        label="Map Info"
    />
</fieldset>

<fieldset name="eblast" label="eBlast">
    <field
        name="eblastinfo"
        type="text"
        label="Eblast Info"
    />
</fieldset>

You will see I've used name="map" and name="eblast".

Update:

To access the parameters, you can simply use the following:

$this->params->get('mapinfo');
$this->params->get('eblastinfo');

Hope this helps

5
  • Oh @Lodder You little beauty! it worked. Such a little thing that i would never have guessed as im working backwards with this stuff. Meaning my knowledge is in snippets as i need to know rather than geekified braniac code freak like some people i encounter online when asking a 'nube' question.Im guessing that retrieving those values will be ->map->mapinfo etc... Ill check, but thank you so much!!! - once i have checked ill come back and mark you correct and add an update to my question yes? Maybe you can help me with my other question about 'Custom Component 3 levels deep' components :)
    – Jonnypixel
    Commented Nov 4, 2014 at 0:39
  • @Jonnypixel - Glad it helped ;) I've updated my answer with how to access the parameter. It appears you have already accepted the answer for your other question.
    – Lodder
    Commented Nov 4, 2014 at 0:50
  • Thankyou again - yes i did accept it but only because it made sense. Should i unaccept it in order fro you to help out there? is that what you mean? Also i just realized that i think params wont work. The content table has attribs. Testing now
    – Jonnypixel
    Commented Nov 4, 2014 at 0:54
  • No, do not unaccept it unless someone provides you with a solid answer to your question. I will take a look tomorrow but you may want to comment below the current answer and ask for more detail ;)
    – Lodder
    Commented Nov 4, 2014 at 0:56
  • Ah ok, Thanks Lodder. I will go back to it and ask more. I think i didi ask him to elaborate more on the FoF thing. Because i think he did point me the right way. I just dont quite understand how t implement it.
    – Jonnypixel
    Commented Nov 4, 2014 at 1:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.