mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE Deprecated FormField->describe(), use setDescription() instead. Actually use the description in form fields other than FormAction.
This commit is contained in:
parent
69a8659a3d
commit
55a0fb18e4
@ -337,6 +337,7 @@ class FormField extends RequestHandler {
|
|||||||
'id' => $this->ID(),
|
'id' => $this->ID(),
|
||||||
'tabindex' => $this->getTabIndex(),
|
'tabindex' => $this->getTabIndex(),
|
||||||
'disabled' => $this->isDisabled(),
|
'disabled' => $this->isDisabled(),
|
||||||
|
'title' => $this->getDescription(),
|
||||||
);
|
);
|
||||||
return array_merge($attrs, $this->attributes);
|
return array_merge($attrs, $this->attributes);
|
||||||
}
|
}
|
||||||
@ -689,14 +690,22 @@ class FormField extends RequestHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 3.0 Use setDescription()
|
||||||
|
*/
|
||||||
|
function describe($description) {
|
||||||
|
Deprecation::notice('3.0', 'Use setDescription()');
|
||||||
|
$this->setDescription($description);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe this field, provide help text for it.
|
* Describe this field, provide help text for it.
|
||||||
* The function returns this so it can be used like this:
|
* By default, renders as a "title" attribute on the form field.
|
||||||
* $action = FormAction::create('submit', 'Submit')->describe("Send your changes to be approved")
|
|
||||||
*
|
*
|
||||||
* @return string Description
|
* @return string Description
|
||||||
*/
|
*/
|
||||||
function describe($description) {
|
function setDescription($description) {
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ul id="$ID" class="$extraClass">
|
<ul id="$ID" class="$extraClass"<% if Description %> title="$Description"<% end_if %>>
|
||||||
<% if Options.Count %>
|
<% if Options.Count %>
|
||||||
<% control Options %>
|
<% control Options %>
|
||||||
<li class="$Class">
|
<li class="$Class">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ul id="$ID" class="$extraClass">
|
<ul id="$ID" class="$extraClass"<% if Description %> title="$Description"<% end_if %>>
|
||||||
<% control Options %>
|
<% control Options %>
|
||||||
<li class="$Class">
|
<li class="$Class">
|
||||||
<input id="$ID" class="radio" name="$Name" type="radio" value="$Value"<% if isChecked %> checked<% end_if %><% if isDisabled %> disabled<% end_if %>>
|
<input id="$ID" class="radio" name="$Name" type="radio" value="$Value"<% if isChecked %> checked<% end_if %><% if isDisabled %> disabled<% end_if %>>
|
||||||
|
Loading…
Reference in New Issue
Block a user