Skip to content

Commit

Permalink
Backend/Config: Add shortlink to resource
Browse files Browse the repository at this point in the history
fixes #7493
  • Loading branch information
mxhash committed Nov 7, 2014
1 parent a460286 commit cb09c8a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/monitoring/application/forms/Config/BackendConfigForm.php
Expand Up @@ -225,15 +225,31 @@ public function createElements(array $formData)
'value' => $resourceType
)
);
$this->addElement(

$resourceElement = $this->createElement(
'select',
'resource',
array(
'required' => true,
'label' => mt('monitoring', 'Resource'),
'description' => mt('monitoring', 'The resource to use'),
'multiOptions' => $this->resources[$resourceType]
'multiOptions' => $this->resources[$resourceType],
'autosubmit' => true
)
);

$resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource');
if ($resourceElement) {
$resourceElement->getDecorator('Description')->setEscape(false);
$link = sprintf(
'<a href="%s" data-base-target="_main">%s</a>',
$this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)),
mt('monitoring', 'Show resource configuration')
);
$resourceElement->setDescription($resourceElement->getDescription() . ' (' . $link . ')');
}

$this->addElement($resourceElement);

}
}

0 comments on commit cb09c8a

Please sign in to comment.