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', 'select',
'resource', 'resource',
array( array(
@ -229,32 +231,35 @@ class BackendConfigForm extends ConfigForm
'label' => $this->translate('Resource'), 'label' => $this->translate('Resource'),
'description' => $this->translate('The resource to use'), 'description' => $this->translate('The resource to use'),
'multiOptions' => $this->resources[$resourceType], 'multiOptions' => $this->resources[$resourceType],
'value' => current($this->resources[$resourceType]),
'decorators' => $decorators,
'autosubmit' => true 'autosubmit' => true
) )
); );
$resourceName = isset($formData['resource']) ? $formData['resource'] : $this->getValue('resource');
if (empty($formData)) { $this->addElement(
$options = $resourceElement->options; 'note',
$resourceName = array_shift($options); 'resource_note',
} else { array(
$resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource'); 'escape' => false,
} 'decorators' => $decorators,
'value' => sprintf(
$this->addElement($resourceElement); '<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)),
if ($resourceElement) { sprintf($this->translate('Show the configuration of the %s resource'), $resourceName),
$this->addElement( $this->translate('Show resource configuration')
'note',
'resource_note',
array(
'value' => sprintf(
'<a href="%s" data-base-target="_main">%s</a>',
$this->getView()->url('config/editresource', array('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'))
)
)
);
} }
} }