If it did not,
we would have to merge the two manually.
The returned object is of type JParameter. This class deals specifically with XML
metadata files, which define parameters. To get a value from the component
parameters we use the get() method:
$title = $params->get('title');
We can use this snippet of code anywhere in our component. Many of the core
components retrieve component parameters in models, views, and controllers.
Chapter 4
[ 95 ]
Elements and Parameters
We have mentioned using parameters in the component configuration file; there are
many other instances where we can use the param tag, for example defining module
parameters. When we use the param tag in XML files, we are defining data items. As
part of this we use the XML to produce rendered forms. JElement is the abstract class
subclasses of which can be used to render each of the parameters.
JElement subclasses are used in conjunction with a single param tag and render a
form input tag based upon it. There are a number of predefined parameter types
(JElements) that we can use:
category
editors
filelist
folderlist
helpsites
hidden
imagelist
languages
list
menu
menuitem
password
radio
section
spacer
sql
text
textarea
timzones
A full description of each of these is available in the Appendix.
Pages:
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142