Add proper title to the BackendConfigForms's jump link...

...and move it to the right of the respective form control

refs #8458
This commit is contained in:
Johannes Meyer 2015-02-23 17:09:37 +01:00
parent bd9d06574d
commit 5fd447394c
1 changed files with 29 additions and 24 deletions

View File

@ -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) {
$resourceName = isset($formData['resource']) ? $formData['resource'] : $this->getValue('resource');
$this->addElement(
'note',
'resource_note',
array(
'escape' => false,
'decorators' => $decorators,
'value' => sprintf(
'<a href="%s" data-base-target="_main">%s</a>',
'<a href="%1$s" data-base-target="_next" title="%2$s" aria-label="%2$s">%3$s</a>',
$this->getView()->url('config/editresource', array('resource' => $resourceName)),
sprintf($this->translate('Show the configuration of the %s resource'), $resourceName),
$this->translate('Show resource configuration')
),
'escape' => false
)
)
);
$this->addDisplayGroup(
array('resource', 'resource_note'),
'resource-group',
array(
'decorators' => array(
'FormElements',
array('HtmlTag', array('tag' => 'div', 'class' => 'element'))
)
)
);
}
}
}