mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
DirectorObjectForm: simplify inhertance code
This commit is contained in:
parent
09e9b7aa10
commit
00f21f838b
@ -236,23 +236,20 @@ abstract class DirectorObjectForm extends QuickForm
|
|||||||
|
|
||||||
$this->setDefaults($props);
|
$this->setDefaults($props);
|
||||||
|
|
||||||
if (! $object instanceof IcingaObject) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($resolve) {
|
if ($resolve) {
|
||||||
$inherited = $object->getInheritedProperties();
|
$this->showInheritedProperties($object);
|
||||||
$origins = $object->getOriginsProperties();
|
|
||||||
} else {
|
|
||||||
$inherited = (object) array();
|
|
||||||
$origins = (object) array();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($props as $k => $v) {
|
protected function showInheritedProperties($object)
|
||||||
$this->setElementValue($k, $v);
|
{
|
||||||
if ($k !== 'object_name' && property_exists($inherited, $k)) {
|
$inherited = $object->getInheritedProperties();
|
||||||
|
$origins = $object->getOriginsProperties();
|
||||||
|
|
||||||
|
foreach ($inherited as $k => $v) {
|
||||||
|
if ($v !== null && $k !== 'object_name') {
|
||||||
$el = $this->getElement($k);
|
$el = $this->getElement($k);
|
||||||
if ($el && $resolve) {
|
if ($el) {
|
||||||
$this->setInheritedValue($el, $inherited->$k, $origins->$k);
|
$this->setInheritedValue($el, $inherited->$k, $origins->$k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user