From 268dc7e4b14bf685a8fb12e5b6c3a0ce57a1896f Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 18 Nov 2014 18:06:36 +0100 Subject: [PATCH] Fix the add link to the resource configuration refs #7493 --- .../forms/Config/BackendConfigForm.php | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php index f467b8f59..4b1aa65b6 100644 --- a/modules/monitoring/application/forms/Config/BackendConfigForm.php +++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php @@ -237,18 +237,28 @@ class BackendConfigForm extends ConfigForm ) ); - $resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource'); - if ($resourceElement) { - $resourceElement->getDecorator('Description')->setEscape(false); - $link = sprintf( - '%s', - $this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)), - mt('monitoring', 'Show resource configuration') - ); - $resourceElement->setDescription($resourceElement->getDescription() . ' (' . $link . ')'); + if (empty($formData)) { + $options = $resourceElement->options; + $resourceName = array_shift($options); + } else { + $resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource'); } $this->addElement($resourceElement); + if ($resourceElement) { + $this->addElement( + 'note', + 'resource_note', + array( + 'value' => sprintf( + '%s', + $this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)), + mt('monitoring', 'Show resource configuration') + ), + 'escape' => false + ) + ); + } } }