mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Changed FormField->Field() to make use of FormField->createTag() over complicated dynamic string building
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64682 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c004cc9b2f
commit
691776a254
@ -296,10 +296,25 @@ class FormField extends RequestHandlingData {
|
||||
* Our base FormField class just returns a span containing the value. This should be overridden!
|
||||
*/
|
||||
function Field() {
|
||||
if($this->value) $val = $this->dontEscape ? ($this->reserveNL?Convert::raw2xml($this->value):$this->value) : Convert::raw2xml($this->value);
|
||||
else $val = '<i>('._t('FormField.NONE', 'none').')</i>';
|
||||
$valforInput = $this->value ? Convert::raw2att($val) : "";
|
||||
return "<span class=\"readonly ".$this->extraClass()."\" id=\"" . $this->id() . "\">$val</span>\n<input type=\"hidden\" name=\"".$this->name."\" value=\"".$valforInput."\"" . $this->getTabIndexHTML() . " />";
|
||||
if($this->value) $value = $this->dontEscape ? ($this->reserveNL ? Convert::raw2xml($this->value) : $this->value) : Convert::raw2xml($this->value);
|
||||
else $value = '<i>(' . _t('FormField.NONE', 'none') . ')</i>';
|
||||
|
||||
$attributes = array(
|
||||
'id' => $this->id(),
|
||||
'class' => 'readonly' . ($this->extraClass() ? $this->extraClass() : '')
|
||||
);
|
||||
|
||||
$hiddenAttributes = array(
|
||||
'type' => 'hidden',
|
||||
'name' => $this->name,
|
||||
'value' => $this->value,
|
||||
'tabindex' => $this->getTabIndex()
|
||||
);
|
||||
|
||||
$containerSpan = $this->createTag('span', $attributes, $value);
|
||||
$hiddenInput = $this->createTag('input', $hiddenAttributes);
|
||||
|
||||
return $containerSpan . "\n" . $hiddenInput;
|
||||
}
|
||||
/**
|
||||
* Returns a "Field Holder" for this field - used by templates.
|
||||
|
Loading…
x
Reference in New Issue
Block a user