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(),
|
||||
'tabindex' => $this->getTabIndex(),
|
||||
'disabled' => $this->isDisabled(),
|
||||
'title' => $this->getDescription(),
|
||||
);
|
||||
return array_merge($attrs, $this->attributes);
|
||||
}
|
||||
@ -689,16 +690,24 @@ class FormField extends RequestHandler {
|
||||
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.
|
||||
* The function returns this so it can be used like this:
|
||||
* $action = FormAction::create('submit', 'Submit')->describe("Send your changes to be approved")
|
||||
* By default, renders as a "title" attribute on the form field.
|
||||
*
|
||||
* @return string Description
|
||||
*/
|
||||
function describe($description) {
|
||||
function setDescription($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 %>
|
||||
<% control Options %>
|
||||
<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 %>
|
||||
<li class="$Class">
|
||||
<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