How To Find Available Attributes for Parameter Elements

Written by James Hafner | November 04, 2009 | Add Comment (0)

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.

Trackback(0)

Comments (0)Add Comment


Write comment

You must be logged in to post a comment. Please register if you do not have an account yet.

busy

Join the HowToJoomla Community!

  • Create a profile
  • Connect with other members
    of the community
  • All for FREE

Sign up now!

 

Already a member? Login here.

HowToJoomla is proudly hosted by Eleven2

 
 
 

Search the Joomla! Community for Resources

 
 

Latest Community Activity

2 days ago
Laura Gonzalez added Feeds application 05:57 PM
Laura Gonzalez added My Articles application 05:57 PM
Rita Lewis replied in a discussion Front end password protection 02:33 PM
Sean Grant added Feeds application 01:47 PM
Sean Grant added My Articles application 01:46 PM
Rita Lewis added a new wall post in the group HowToJoomla! 01:42 PM
Rita Lewis joined a group HowToJoomla! 01:36 PM
Rita Lewis added My Articles application 01:35 PM
Rita Lewis added Feeds application 01:35 PM
6 days ago
Elizabeth added a new wall post in the group HowToJoomla! 02:57 PM
 

Welcome to Our Newest Community Members

My BZ
Patsy Caldwell
Mark C
nkdararaneta
Laura Gonzalez
Sean Grant
Janz
Rita Lewis
Ali Kilic
Heislyc
Gerhard Frischholz
deepa
 
 

Latest Comments

How to Move Your Joo

JohnK, I came up against the same issue. Assuming ...

How To Make Multiple

Hi, need help in adjusting the column widths (alte ...

Tools YOU need to kn

Hey, thanks, great idea and great execution! But ...

How to Move Your Joo

Hi Robert! Try to contact your older hosting pro ...

Help! I've been hack

This is really good information for all Joomla use ...