JRegistry/merge
From Joomla! Documentation
< API16:JRegistry
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Merge a JRegistry object into this one
Template:Description:JRegistry/merge
Syntax[edit]
merge(&$source)
Parameter Name | Default Value | Description |
---|---|---|
&$source | Source object ot merge |
Returns[edit]
boolean True on success
Defined in[edit]
libraries/joomla/registry/registry.php
Importing[edit]
jimport( 'joomla.registry.registry' );
Source Body[edit]
public function merge(&$source)
{
if ($source instanceof JRegistry) {
$sns = $source->getNameSpaces();
foreach ($sns as $ns) {
if (!isset($this->_registry[$ns])) {
// If namespace does not exist, make it and load the data
$this->makeNameSpace($ns);
}
// Load the variables into the registry's default namespace.
foreach ($source->toArray($ns) as $k => $v) {
if ($v != null) {
$this->_registry[$ns]['data']->$k = $v;
}
}
}
return true;
}
return false;
}
[Edit See Also] Template:SeeAlso:JRegistry/merge
Examples[edit]
<CodeExamplesForm />