Parameter Elements
You're probably aware of the different parameter elements available to you, but just in case you're not, here they are:
- calendar
- category
- editors
- filelist
- folderlist
- helpsites
- hidden
- imagelist
- languages
- list
- menu
- menuitem
- password
- radio
- section
- spacer
- sql
- text
- textarea
- timezones
- usergroup
So, when you're using one of these in a new extension, or you're modifying an extension, how do you know what attributes Joomla! will be looking for beyond the default attributes (name, type, default, label, and description)? With a little digging, it's pretty easy to determine.
Go Digging
Using your favorite FTP client or file explorer of choice, open up the files of your Joomla! installation. Navigate all the way to the following folder:
/libraries/html/parameter/elementml
Inside that /elements folder, you'll see a PHP file for each of our parameter elements. Open up calendar.php and look for the first (and only) function in the file. You should see something like this:
function fetchElement($name, $value, &$node, $control_name)
{
JHTML::_('behavior.calendar'); //load the calendar behavior
$format = ( $node->attributes('format') ? $node->attributes('format') : '%Y-%m-%d' );
$class = $node->attributes('class') ? $node->attributes('class') : 'inputbox';
$id = $control_name.$name;
$name = $control_name.'['.$name.']';
return JHTML::_('calendar', $value, $name, $id, $format, array('class' => $class));
}
The secret here is to look for the variables with a node. The calendar parameter type has two attributes: format, and class. Some parameters have more, some have less, each depending on what they're intended to do. However, exploring other parameter elements uncovers a few hidden secrets not seen in many extensions. For example, the folderlist parameter has the attributes "hide_none" and "hide_default", which hide the "None" and "Default" options from the folder list respectively.