mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 09:34:39 +00:00
Revert "(mvc) remove unused getFlatNodes"
This reverts commit 6c6b861e778704d2aa2d06b569a1e3071f065465.
This commit is contained in:
parent
6c6b861e77
commit
5bbced8090
@ -259,6 +259,15 @@ abstract class BaseModel
|
||||
$this->internalData->$name = $value ;
|
||||
}
|
||||
|
||||
/**
|
||||
* forward to root node's getFlatNodes
|
||||
* @return array all children
|
||||
*/
|
||||
public function getFlatNodes()
|
||||
{
|
||||
return $this->internalData->getFlatNodes();
|
||||
}
|
||||
|
||||
/**
|
||||
* get nodes as array structure
|
||||
* @return array
|
||||
|
||||
@ -388,6 +388,27 @@ abstract class BaseField
|
||||
return $this->internalXMLTagName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive method to flatten tree structure for easy validation, returns only leaf nodes.
|
||||
* @return array named array with field type nodes, using the internal reference.
|
||||
*/
|
||||
public function getFlatNodes()
|
||||
{
|
||||
$result = array ();
|
||||
if (count($this->internalChildnodes) == 0) {
|
||||
return array($this);
|
||||
}
|
||||
|
||||
foreach ($this->__items as $node) {
|
||||
foreach ($node->getFlatNodes() as $childNode) {
|
||||
$result[$childNode->internalReference] = $childNode ;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get nodes as array structure
|
||||
* @return array
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user