Permalink
Browse files

API CHANGE Deprecated FormField->describe(), use setDescription() ins…

…tead. Actually use the description in form fields other than FormAction.
  • Loading branch information...
1 parent 69a8659 commit 55a0fb18e480fe36aa9a851df186491ee4f9e5f1 @chillu chillu committed Mar 7, 2012
Showing with 15 additions and 6 deletions.
  1. +13 −4 forms/FormField.php
  2. +1 −1 templates/forms/CheckboxSetField.ss
  3. +1 −1 templates/forms/OptionsetField.ss
View
@@ -337,6 +337,7 @@ function getAttributes() {
'id' => $this->ID(),
'tabindex' => $this->getTabIndex(),
'disabled' => $this->isDisabled(),
+ 'title' => $this->getDescription(),
);
return array_merge($attrs, $this->attributes);
}
@@ -690,15 +691,23 @@ function validate() {
}
/**
+ * @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 %>>

0 comments on commit 55a0fb1

Please sign in to comment.