How To Find Available Attributes for Parameter Elements |
| November 3, 2009 |
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 ElementsYou're probably aware of the different parameter elements available to you, but just in case you're not, here they are:
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 DiggingUsing 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) 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. |
Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.
Copyright © 2012 Open Source Training, LLC. All rights reserved.