Back to Form class

Method mergeNode

protected static void
mergeNode
(\SimpleXMLElement $source, \SimpleXMLElement $new)
Update the attributes of a child node
Parameters
  • \SimpleXMLElement $source The source element on which to append the attributes
  • \SimpleXMLElement $new The new element to append
Returns
  • void
Since
  • 1.7.0
Class: Form
Project: Joomla

Method mergeNode - Source code

/**
 * Update the attributes of a child node
 *
 * @param   \SimpleXMLElement  $source  The source element on which to append the attributes
 * @param   \SimpleXMLElement  $new     The new element to append
 *
 * @return  void
 *
 * @since   1.7.0
 */
protected static function mergeNode(\SimpleXMLElement $source, \SimpleXMLElement $new)
{
    // Update the attributes of the child node.
    foreach ($new->attributes() as $name => $value) {
        if (isset($source[$name])) {
            $source[$name] = (string) $value;
        } else {
            $source->addAttribute($name, $value);
        }
    }
}