This how-to is aimed more at Joomla! developers than our beginner or intermediate Joomla! user crowd. When creating an extension (module, component, plugin, or template), it's often necessary to give users the ability to choose custom settings by giving them Parameter options. Interacting with parameters will be for another How-To, but today I want to show you how to find the available attributes for a particular parameter element.

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.

Login to post comments

advertise with us

Boost your traffic and expand your pool of potential customers

8000 active members

Ready to join Now?

CMS Portal - The free marketplace for submitting Joomla, Drupal, Wordpress, Magento, phpBB, Prestashop, vBulletin, Opencart Templates and more.

FOLLOW US

Email Newsletters

Make sure you don't miss interesting happenings by joining our newsletter program.
konya escort eskisehir escort canakkale escort samsun escort balikesir escort aydin escort hatay escort kahramanmaras escort giresun escort tokat escort
Joomla Templates Free Joomla Templates Virtuemart Templates K2 Templates JoomShopping Templates HikaShop Templates SobiPro Templates OpenCart Themes
Magento Themes Magento Extensions Free Magento Extensions Prestashop Themes Prestashop Modules Magento 2 Themes
bettilt
tempobet