Horde_Kolab_Format_Xml_Type_Composite::save PHP Method

save() public method

Update the specified attribute.
public save ( string $name, array $attributes, DOMNode $parent_node, Horde_Kolab_Format_Xml_Helper $helper, array $params = [] ) : DOMNode | boolean
$name string The name of the the attribute to be updated.
$attributes array The data array that holds all attribute values.
$parent_node DOMNode The parent node of the node that should be updated.
$helper Horde_Kolab_Format_Xml_Helper A XML helper instance.
$params array Additional parameters for this write operation.
return DOMNode | boolean The new/updated child node or false if this failed.
    public function save($name, $attributes, $parent_node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
    {
        $node = $helper->findNodeRelativeTo('./' . $name, $parent_node);
        if (!$this->merge && !isset($attributes[$name])) {
            if ($node === false) {
                if ($this->value == Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING || $this->value == Horde_Kolab_Format_Xml::VALUE_NOT_EMPTY && $this->isRelaxed($params)) {
                    return false;
                }
            } else {
                if ($this->value == Horde_Kolab_Format_Xml::VALUE_MAYBE_MISSING) {
                    /** Client indicates that the value should get removed */
                    $helper->removeNodes($parent_node, $name);
                    return false;
                } else {
                    return $node;
                }
            }
        }
        return $this->saveNodeValue($name, $this->generateWriteValue($name, $attributes, $params), $parent_node, $helper, $params, $node);
    }

Usage Example

Exemplo n.º 1
0
 public function save($name, $attributes, $parent_node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     if (isset($params['array'])) {
         $this->elements = $params['array'];
         unset($params['array']);
     }
     if (isset($params['value'])) {
         $this->value = $params['value'];
         unset($params['value']);
     }
     if (isset($params['default'])) {
         $this->default = $params['default'];
         unset($params['default']);
     }
     return parent::save($name, $attributes, $parent_node, $helper, $params);
 }
All Usage Examples Of Horde_Kolab_Format_Xml_Type_Composite::save