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:
https://docs.joomla.org/J3.x:Creating_a_simple_module/Adding_Form_Fields
So a basic example:
mod_something.xml
<config>
<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>
<fieldset name="advanced">
<field name="param3" type="text" default="something" label="Param 3" />
<field name="param4" type="text" default="something" label="Param 4" />
</fieldset>
</fields>
</config>
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 !== '')
{
$moduleParams->loadString($module->params);
}
return $moduleParams;
}
// Non-Static function example
public function yourFunction()
{
$this->params->get('size');
}
// Static function example
public static function yourStaticFunction()
{
$helper = new ModSomethingHelper();
$size = $helper->getParams()->get('size');
}
}