mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-26 03:09:11 +02:00
IcingaObjectFieldLoader: allow to combine objects
This commit is contained in:
parent
f87e80989d
commit
c41009992e
@ -25,13 +25,36 @@ class IcingaObjectFieldLoader
|
|||||||
|
|
||||||
public function addFieldsToForm(QuickForm $form)
|
public function addFieldsToForm(QuickForm $form)
|
||||||
{
|
{
|
||||||
if ($this->object->supportsFields()) {
|
if ($this->fields || $this->object->supportsFields()) {
|
||||||
$this->attachFieldsToForm($form);
|
$this->attachFieldsToForm($form);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function loadFieldsForMultipleObjects($objects)
|
||||||
|
{
|
||||||
|
$fields = array();
|
||||||
|
foreach ($objects as $object) {
|
||||||
|
foreach ($this->prepareObjectFields($object) as $varname => $field) {
|
||||||
|
$varname = $field->varname;
|
||||||
|
if (array_key_exists($varname, $fields)) {
|
||||||
|
if ($field->datatype !== $fields[$varname]->datatype) {
|
||||||
|
unset($fields[$varname]);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields[$field->varname] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fields = $fields;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a list of values
|
* Set a list of values
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user