Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
5bbced80
Commit
5bbced80
authored
Aug 08, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "(mvc) remove unused getFlatNodes"
This reverts commit
6c6b861e
.
parent
6c6b861e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
BaseModel.php
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
+9
-0
BaseField.php
...nse/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php
+21
-0
No files found.
src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php
View file @
5bbced80
...
...
@@ -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
...
...
src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php
View file @
5bbced80
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment