on the documentation for creating a module, the basic is all there but they don't talk about giving parameters to your module.

Example the color of the background or the size whatever.

So I want to know is there any documentation about creating a form that gives this parameters by the admin after installing the module.

My module is basically complete in a way but I want the user to be able to customize it.

I know my question doesnt have code involve. But I've been told to come here if I have questions about joomla since i'm rather new to this.


1 Answer 1


Welcome to JSE.

I'm not sure which documentation you've been referring to, however the Joomla Docs show you how to add parameters to your module:


So a basic example:


  <fields name="params">
    <fieldset name="basic">
        <field name="size" type="text" default="20px" label="Size" />
        <field name="background" type="color" default="#eee" format="hex" label="Background" />
    <fieldset name="advanced">
        <field name="param3" type="text" default="something" label="Param 3" />
        <field name="param4" type="text" default="something" label="Param 4" />

Note; I've added another fieldset which will show you how to separate your parameters under different tabs.

Accessing the parameters (Views):

$size = $params->get('size');
$background = $params->get('background');

$param3 = $params->get('param3');
$param4 = $params->get('param4');

Accessing the parameters (Helper):

class ModSomethingHelper
    private $params = null;

    public function __construct()
        $this->params = $this->getParams();

    public function getParams()
        $module = JModuleHelper::getModule('mod_something');
        $moduleParams = new JRegistry;

        if ($module->params !== '')

        return $moduleParams;

    // Non-Static function example
    public function yourFunction()

    // Static function example
    public static function yourStaticFunction()
        $helper = new ModSomethingHelper();

        $size = $helper->getParams()->get('size');
  • I wish I could upvote you .thank you so much for the fast reply. I appreciate it! So I can put multilple fields in the same fieldset?
    – user13380
    Mar 8, 2019 at 15:12
  • You're more than welcome. Yes, you can put as many as you want in there. You can also create a separate fieldset which will create a new tab for you. I've updated my example above to show you.
    – Lodder
    Mar 8, 2019 at 15:32
  • Perfect that works . Last question sorry to bother you again. The way you access the parameter like that would be only in the Module Entry Point? Or I would be able to access them on my helper.php too?
    – user13380
    Mar 8, 2019 at 15:40
  • No worries. Not in the helper. I'll update my answer with the code for that
    – Lodder
    Mar 8, 2019 at 15:45
  • @engjellbislimi - I've updated the answer showing you how to get them in a static and non-static function
    – Lodder
    Mar 8, 2019 at 15:52

Your Answer

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