From 5fd447394c2d7000dc3511ca8a6ed94660cb3e2f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 23 Feb 2015 17:09:37 +0100 Subject: [PATCH] Add proper title to the BackendConfigForms's jump link... ...and move it to the right of the respective form control refs #8458 --- .../forms/Config/BackendConfigForm.php | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php index e0f8e3e0d..3014974a3 100644 --- a/modules/monitoring/application/forms/Config/BackendConfigForm.php +++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php @@ -221,7 +221,9 @@ class BackendConfigForm extends ConfigForm ) ); - $resourceElement = $this->createElement( + $decorators = static::$defaultElementDecorators; + array_pop($decorators); // Removes the HtmlTag decorator + $this->addElement( 'select', 'resource', array( @@ -229,32 +231,35 @@ class BackendConfigForm extends ConfigForm 'label' => $this->translate('Resource'), 'description' => $this->translate('The resource to use'), 'multiOptions' => $this->resources[$resourceType], + 'value' => current($this->resources[$resourceType]), + 'decorators' => $decorators, 'autosubmit' => true ) ); - - 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()->url('config/editresource', array('resource' => $resourceName)), - $this->translate('Show resource configuration') - ), - 'escape' => false + $resourceName = isset($formData['resource']) ? $formData['resource'] : $this->getValue('resource'); + $this->addElement( + 'note', + 'resource_note', + array( + 'escape' => false, + 'decorators' => $decorators, + 'value' => sprintf( + '%3$s', + $this->getView()->url('config/editresource', array('resource' => $resourceName)), + sprintf($this->translate('Show the configuration of the %s resource'), $resourceName), + $this->translate('Show resource configuration') ) - ); - } + ) + ); + $this->addDisplayGroup( + array('resource', 'resource_note'), + 'resource-group', + array( + 'decorators' => array( + 'FormElements', + array('HtmlTag', array('tag' => 'div', 'class' => 'element')) + ) + ) + ); } }