JParameter
Extends \JRegistryParameter handler
| package |
Joomla.Platform |
|---|---|
| subpackage |
Parameter |
| since |
11.1 |
| deprecated |
12.1 Use JForm instead |
Methods
__clone
Magic function to clone the registry object.
__clone() : \JRegistry
__construct
Constructor
__construct(mixed $data = null)
| since |
11.1 |
|---|
Arguments
- $data
mixedThe data to bind to the new JRegistry object.
__toString
Magic function to render this object as a string using default args of toString method.
__toString() : string
| since |
11.1 |
|---|
Response
string
addElementPath
Add a directory where JParameter should search for element types.
addElementPath(mixed $path) : void
You may either pass a string or an array of directories.
JParameter will be searching for a element type in the same order you added them. If the parameter type cannot be found in the custom folders, it will look in JParameter/types.
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $path
mixedDirectory (string) or directories (array) to search.
asArray
Method to recursively convert an object of data to an array.
asArray(object $data) : array
| since |
11.1 |
|---|
Arguments
- $data
objectAn object of data to return as an array.
Response
arrayArray representation of the input object.
bind
Bind data to the parameter.
bind(mixed $data, string $group = '_default') : boolean
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $data
mixedAn array or object.- $group
stringAn optional group that the data should bind to. The default group is used if not supplied.
Response
booleanTrue if the data was successfully bound, false otherwise.
bindData
Method to recursively bind data to a parent object.
bindData( &$parent, mixed $data) : void
| since |
11.1 |
|---|
Arguments
- $parent
- $data
mixedAn array or object of data to bind to the parent object.
def
Sets a default value if not already assigned.
def(string $key, string $default = '') : string
| since |
11.1 |
|---|
Arguments
- $key
stringThe name of the parameter.- $default
stringAn optional value for the parameter.
Response
stringThe value set, or the default if the value was not previously set (or null).
exists
Check if a registry path exists.
exists(string $path) : boolean
| since |
11.1 |
|---|
Arguments
- $path
stringRegistry path (e.g. joomla.content.showauthor)
Response
boolean
get
Get a registry value.
get(string $path, mixed $default = null) : mixed
| since |
11.1 |
|---|
Arguments
- $path
stringRegistry path (e.g. joomla.content.showauthor)- $default
mixedOptional default value, returned if the internal value is null.
Response
mixedValue of entry or null
getGroups
Get the number of params in each group.
getGroups() : array
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Response
arrayArray of all group names as key and parameters count as value.
getInstance
Returns a reference to a global JRegistry object, only creating it if it doesn't already exist.
getInstance(string $id) : object
This method must be invoked as:
$registry = JRegistry::getInstance($id);
| since |
11.1 |
|---|
Arguments
- $id
stringAn ID for the registry instance
Response
objectThe JRegistry object.
getNameSpaces
Get the list of namespaces
getNameSpaces() : array
| deprecated |
12.1 |
|---|---|
| note |
Namespaces are no longer supported. |
| since |
11.1 |
Response
arrayList of namespaces
getNumParams
Return the number of parameters in a group.
getNumParams(string $group = '_default') : mixed
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $group
stringAn optional group. The default group is used if not supplied.
Response
mixedFalse if no params exist or integer number of parameters that exist.
getParam
Render a parameter type.
getParam( &$node, string $control_name = 'params', string $group = '_default') : array
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $node
- $control_name
stringAn optional name of the HTML form control. The default is 'params' if not supplied.- $group
stringAn optional group to render. The default group is used if not supplied.
Response
arrayAny array of the label, the form element and the tooltip.
getParams
Render all parameters.
getParams(string $name = 'params', string $group = '_default') : array
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $name
stringAn optional name of the HTML form control. The default is 'params' if not supplied.- $group
stringAn optional group to render. The default group is used if not supplied.
Response
arrayAn array of all parameters, each as array of the label, the form element and the tooltip.
getValue
Get a registry value
getValue(string $path, mixed $default = null) : mixed
| deprecated |
12.1 |
|---|---|
| note |
Use get instead. |
| since |
11.1 |
Arguments
- $path
stringRegistry path (e.g. joomla.content.showauthor)- $default
mixedOptional default value
Response
mixedValue of entry or null
loadArray
Load a associative array of values into the default namespace
loadArray(array $array) : boolean
| since |
11.1 |
|---|
Arguments
- $array
arrayAssociative array of value to load
Response
booleanTrue on success
loadElement
Loads an element type.
loadElement(string $type, boolean $new = false) : object
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $type
stringThe element type.- $new
booleanFalse (default) to reuse parameter elements; true to load the parameter element type again.
Response
object
loadFile
Load the contents of a file into the registry
loadFile(string $file, string $format = 'JSON', mixed $options = array()) : boolean
| since |
11.1 |
|---|
Arguments
- $file
stringPath to file to load- $format
stringFormat of the file [optional: defaults to JSON]- $options
mixedOptions used by the formatter
Response
booleanTrue on success
loadINI
Load an INI string into the registry into the given namespace [or default if a namespace is not given]
loadINI(string $data, string $namespace = null, mixed $options = array()) : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use loadString passing INI as the format instead. |
Arguments
- $data
stringINI formatted string to load into the registry- $namespace
stringNamespace to load the INI string into [optional]- $options
mixedAn array of options for the formatter, or boolean to process sections.
Response
booleanTrue on success
loadJSON
Load an JSON string into the registry into the given namespace [or default if a namespace is not given]
loadJSON(string $data) : boolean
| deprecated |
12.1 Use loadString passing JSON as the format instead. |
|---|---|
| note |
Use loadString instead. |
| since |
11.1 |
Arguments
- $data
stringJSON formatted string to load into the registry
Response
booleanTrue on success
loadObject
Load the public variables of the object into the default namespace.
loadObject(object $object) : boolean
| since |
11.1 |
|---|
Arguments
- $object
objectThe object holding the publics to load
Response
booleanTrue on success
loadSetupFile
This method is added as an interim solution for API references in the Joomla! CMS 1.6 to the JRegistry object where in 1.5 a JParameter object existed. Because many extensions may call this method we add it here as a means of "pain relief" until the 1.8 release.
loadSetupFile() : boolean
| deprecated |
12.1 |
|---|---|
| note |
Load no longer supported. |
| since |
11.1 |
Response
booleanTrue.
loadString
Load a string into the registry
loadString(string $data, string $format = 'JSON', mixed $options = array()) : boolean
| since |
11.1 |
|---|
Arguments
- $data
stringString to load into the registry- $format
stringFormat of the string- $options
mixedOptions used by the formatter
Response
booleanTrue on success
loadXML
Load an XML string into the registry into the given namespace [or default if a namespace is not given]
loadXML(string $data, string $namespace = null) : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use loadString passing XML as the format instead. |
| note |
Arguments
- $data
stringXML formatted string to load into the registry- $namespace
stringNamespace to load the XML string into [optional]
Response
booleanTrue on success
makeNameSpace
Create a namespace
makeNameSpace(string $namespace) : boolean
| deprecated |
12.1 |
|---|---|
| note |
Namespaces are no longer supported. |
| since |
11.1 |
Arguments
- $namespace
stringName of the namespace to create
Response
booleanTrue on success
merge
Merge a JRegistry object into this one
merge( &$source) : boolean
| since |
11.1 |
|---|
Arguments
- $source
Response
booleanTrue on success
render
Render the form control.
render(string $name = 'params', string $group = '_default') : string
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $name
stringAn optional name of the HTML form control. The default is 'params' if not supplied.- $group
stringAn optional group to render. The default group is used if not supplied.
Response
stringHTML
renderToArray
Render all parameters to an array.
renderToArray(string $name = 'params', string $group = '_default') : array
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $name
stringAn optional name of the HTML form control. The default is 'params' if not supplied.- $group
stringAn optional group to render. The default group is used if not supplied.
Response
array
set
Set a registry value.
set(string $path, mixed $value) : mixed
| since |
11.1 |
|---|
Arguments
- $path
stringRegistry Path (e.g. joomla.content.showauthor)- $value
mixedValue of entry
Response
mixedThe value of the that has been set.
setValue
Set a registry value
setValue(string $path, mixed $value) : mixed
| deprecated |
12.1 |
|---|---|
| note |
Use set instead. |
| since |
11.1 |
Arguments
- $path
stringRegistry Path (e.g. joomla.content.showauthor)- $value
mixedValue of entry
Response
mixedThe value after setting.
setXML
Sets the XML object from custom XML files.
setXML( &$xml) : void
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $xml
toArray
Transforms a namespace to an array
toArray() : array
| since |
11.1 |
|---|
Response
arrayAn associative array holding the namespace data
toObject
Transforms a namespace to an object
toObject() : object
| since |
11.1 |
|---|
Response
objectAn an object holding the namespace data
toString
Get a namespace in a given string format
toString(string $format = 'JSON', mixed $options = array()) : string
| since |
11.1 |
|---|
Arguments
- $format
stringFormat to return the string in- $options
mixedParameters used by the formatter, see formatters for more info
Response
stringNamespace in string format
Properties
_raw
The raw params string
| since |
11.1 |
|---|
Type(s)
string
_xml
The XML params element
| since |
11.1 |
|---|
Type(s)
object
_elements
Loaded elements
| since |
11.1 |
|---|
Type(s)
array
_elementPath
Directories, where element types can be stored
| since |
11.1 |
|---|
Type(s)
array
data
Registry Object
| since |
11.1 |
|---|
Type(s)
object
instances
JRegistry instances container.
| since |
11.3 |
|---|
Type(s)
array