Skip to content

Commit b18cf4f

Browse files
committed
Fix editing of custom variables for multi-selected objects
1 parent 42a47d6 commit b18cf4f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

application/forms/IcingaMultiEditForm.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function setup()
5151
$loader = new IcingaObjectFieldLoader($object);
5252
$loader->prepareElements($this);
5353
$loader->addFieldsToForm($this);
54+
$this->varNameMap = $loader->getNameMap();
5455

5556
if ($form = $this->relatedForm) {
5657
if ($form instanceof DirectorObjectForm) {
@@ -237,10 +238,6 @@ protected function makeVariants(ZfElement $element)
237238
$this->removeElement($key);
238239
$label = $element->getLabel();
239240

240-
if ($this->isCustomVar($key)) {
241-
$this->varNameMap[$key] = $label;
242-
}
243-
244241
$group = $this->getDisplayGroupForElement($element);
245242
$description = $element->getDescription();
246243

library/Director/Web/Form/IcingaObjectFieldLoader.php

+10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public function addFieldsToForm(DirectorObjectForm $form)
6060
return $this;
6161
}
6262

63+
/**
64+
* Get element names to variable names map (Example: ['elName' => 'varName'])
65+
*
66+
* @return array
67+
*/
68+
public function getNameMap(): array
69+
{
70+
return $this->nameMap;
71+
}
72+
6373
public function loadFieldsForMultipleObjects($objects)
6474
{
6575
$fields = array();

0 commit comments

Comments
 (0)