mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
DirectorObjectForm: improve getSentOrObjectValue()
This commit is contained in:
parent
e56424a20d
commit
7a6bae9430
@ -708,15 +708,23 @@ abstract class DirectorObjectForm extends QuickForm
|
|||||||
|
|
||||||
public function getSentOrObjectValue($name, $default = null)
|
public function getSentOrObjectValue($name, $default = null)
|
||||||
{
|
{
|
||||||
|
// TODO: check whether getSentValue is still needed since element->getValue
|
||||||
|
// is in place (currently for form element default values only)
|
||||||
|
|
||||||
if ($this->hasObject()) {
|
if ($this->hasObject()) {
|
||||||
$value = $this->getSentValue($name);
|
$value = $this->getSentValue($name);
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
|
|
||||||
$object = $this->getObject();
|
$object = $this->getObject();
|
||||||
|
|
||||||
if ($object->hasProperty($name)) {
|
if ($object->hasProperty($name) && $object->$name !== null) {
|
||||||
return $object->$name;
|
return $object->$name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null !== ($val = $this->getElement('object_type')->getValue())) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
return $default;
|
return $default;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -724,7 +732,15 @@ abstract class DirectorObjectForm extends QuickForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->getSentValue($name, $default);
|
if (null !== ($val = $this->getSentValue($name))) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== ($val = $this->getElement('object_type')->getValue())) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user