|
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
| setParent ($element) | |
| getParent () | |
| hasChildren () | |
| getAttribute ($name) | |
| descend ($path) | |
| setAttribute ($name, $value) | |
| asArray () | |
| asCanonicalArray () | |
| asNiceXml ($filename='', $level=0) | |
| innerXml ($level=0) | |
| xmlentities ($value=null) | |
| appendChild ($source) | |
| extend ($source, $overwrite=false) | |
| extendChild ($source, $overwrite=false) | |
| setNode ($path, $value, $overwrite=true) | |
| unsetSelf () | |
Protected Member Functions | |
| _asArray ($isCanonical=false) | |
Protected Attributes | |
| $_parent = null | |
Extends SimpleXML to add valuable functionality to \SimpleXMLElement class
@api
Definition at line 15 of file Element.php.
|
protected |
Returns the node and children as an array
| bool | $isCanonical | - whether to ignore attributes |
Definition at line 197 of file Element.php.
| appendChild | ( | $source | ) |
Appends $source to current node
| \Magento\Framework\Simplexml\Element | $source |
Definition at line 330 of file Element.php.
| asArray | ( | ) |
Returns the node and children as an array
Definition at line 177 of file Element.php.
| asCanonicalArray | ( | ) |
asArray() analog, but without attributes
Definition at line 186 of file Element.php.
| asNiceXml | ( | $filename = '', |
|
$level = 0 |
|||
| ) |
Makes nicely formatted XML from the node
| string | $filename | |
| int | boolean | $level | if false |
Definition at line 234 of file Element.php.
| descend | ( | $path | ) |
Find a descendant of a node by path
Do we need to make it xpath look-a-like?
Check if we still need all this and revert to plain XPath if this makes any sense
param string $path Subset of xpath. Example: "child/grand[@attrName='attrValue']/subGrand"
| string | $path | Example: "child/grand@attrName=attrValue/subGrand" (to make it faster without regex) |
Definition at line 103 of file Element.php.
| extend | ( | $source, | |
$overwrite = false |
|||
| ) |
Extends current node with xml from $source
If $overwrite is false will merge only missing nodes Otherwise will overwrite existing nodes
| \Magento\Framework\Simplexml\Element | $source | |
| boolean | $overwrite |
Definition at line 360 of file Element.php.
| extendChild | ( | $source, | |
$overwrite = false |
|||
| ) |
Extends one node
| \Magento\Framework\Simplexml\Element | $source | |
| boolean | $overwrite |
Definition at line 382 of file Element.php.
| getAttribute | ( | $name | ) |
Returns attribute value by attribute name
| string | $name |
Definition at line 87 of file Element.php.
| getParent | ( | ) |
Returns parent node for the element
Currently using xpath
Definition at line 48 of file Element.php.
| hasChildren | ( | ) |
Enter description here...
Definition at line 68 of file Element.php.
| innerXml | ( | $level = 0 | ) |
Enter description here...
| int | $level |
Definition at line 293 of file Element.php.
| setAttribute | ( | $name, | |
| $value | |||
| ) |
Create attribute if it does not exists and set value to it
| string | $name | |
| string | $value |
Definition at line 163 of file Element.php.
| setNode | ( | $path, | |
| $value, | |||
$overwrite = true |
|||
| ) |
Set node
| string | $path | |
| string | $value | |
| bool | $overwrite |
Definition at line 444 of file Element.php.
| setParent | ( | $element | ) |
For future use
| \Magento\Framework\Simplexml\Element | $element |
Definition at line 35 of file Element.php.
| unsetSelf | ( | ) |
Unset self from the XML-node tree
Note: trying to refer this object as a variable after "unsetting" like this will result in E_WARNING
Definition at line 477 of file Element.php.
| xmlentities | ( | $value = null | ) |
Converts meaningful xml characters to xml entities
| string | $value |
Definition at line 308 of file Element.php.
|
protected |
Definition at line 26 of file Element.php.