mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
MVC, optionally allow dynamic interfaces for InterfaceField, ref https://github.com/opnsense/core/issues/2332
This commit is contained in:
parent
2c2eca7e2f
commit
83bdc4b47e
@ -75,6 +75,11 @@ class InterfaceField extends BaseField
|
||||
*/
|
||||
private $internalAddParentDevices = false;
|
||||
|
||||
/**
|
||||
* @var bool allow dynamic interfaces
|
||||
*/
|
||||
private $internalAllowDynamic = false;
|
||||
|
||||
/**
|
||||
* collect parents for lagg interfaces
|
||||
* @return array named array containing device and lagg interface
|
||||
@ -131,7 +136,7 @@ class InterfaceField extends BaseField
|
||||
// Iterate over all interfaces configuration and collect data
|
||||
if (isset($configObj->interfaces) && $configObj->interfaces->count() > 0) {
|
||||
foreach ($configObj->interfaces->children() as $key => $value) {
|
||||
if (!empty($value->internal_dynamic)) {
|
||||
if (!$this->internalAllowDynamic && !empty($value->internal_dynamic)) {
|
||||
continue;
|
||||
}
|
||||
$allInterfaces[$key] = $value;
|
||||
@ -233,6 +238,19 @@ class InterfaceField extends BaseField
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* select if dynamic (hotplug) interfaces maybe selectable
|
||||
* @param $value boolean value 0/1
|
||||
*/
|
||||
public function setAllowDynamic($value)
|
||||
{
|
||||
if (trim(strtoupper($value)) == "Y") {
|
||||
$this->internalAllowDynamic = true;
|
||||
} else {
|
||||
$this->internalAllowDynamic = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get valid options, descriptions and selected value
|
||||
* @return array
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user