Skip to content

Commit

Permalink
Fix editing of custom variables for multi-selected objects
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Jan 14, 2025
1 parent de8fe10 commit f210795
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 1 addition & 4 deletions application/forms/IcingaMultiEditForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function setup()
$loader = new IcingaObjectFieldLoader($object);
$loader->prepareElements($this);
$loader->addFieldsToForm($this);
$this->varNameMap = $loader->getNameMap();

if ($form = $this->relatedForm) {
if ($form instanceof DirectorObjectForm) {
Expand Down Expand Up @@ -237,10 +238,6 @@ protected function makeVariants(ZfElement $element)
$this->removeElement($key);
$label = $element->getLabel();

if ($this->isCustomVar($key)) {
$this->varNameMap[$key] = $label;
}

$group = $this->getDisplayGroupForElement($element);
$description = $element->getDescription();

Expand Down
10 changes: 10 additions & 0 deletions library/Director/Web/Form/IcingaObjectFieldLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ public function addFieldsToForm(DirectorObjectForm $form)
return $this;
}

/**
* Get element names to variable names map (Example: ['elName' => 'varName'])
*
* @return array
*/
public function getNameMap(): array
{
return $this->nameMap;
}

public function loadFieldsForMultipleObjects($objects)
{
$fields = array();
Expand Down

0 comments on commit f210795

Please sign in to comment.