Actions

API16

JRegistry/merge

From Joomla! Documentation

< API16:JRegistry
Revision as of 04:18, 30 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Merge a JRegistry object into this one

[Edit Descripton]

Description:JRegistry/merge

Syntax

merge(&$source)
Parameter Name Default Value Description
&$source Source object ot merge

Returns

boolean True on success

Defined in

libraries/joomla/registry/registry.php

Importing

jimport( 'joomla.registry.registry' );

Source Body

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] SeeAlso:JRegistry/merge

Examples

<CodeExamplesForm />