From 33960f1af313eb618a8ec8ca24d4e6ffd5a35e74 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 4 Dec 2008 03:27:59 +0000 Subject: [PATCH] ENHANCEMENT Allow setting of the legend value in the Form template by use of Form->setLegend('my legend') git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67422 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/Form.php | 29 ++++++++++++++++++++++++++++- templates/Includes/Form.ss | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/forms/Form.php b/forms/Form.php index 2eddbe8e4..cf73f77ff 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -63,6 +63,15 @@ class Form extends RequestHandler { */ protected $target; + /** + * Legend value, to be inserted into the + * element before the
+ * in Form.ss template. + * + * @var string + */ + protected $legend; + protected $buttonClickedFunc; protected $message; @@ -456,7 +465,15 @@ class Form extends RequestHandler { function setTarget($target) { $this->target = $target; } - + + /** + * Set the legend value to be inserted into + * the element in the Form.ss template. + */ + function setLegend($legend) { + $this->legend = $legend; + } + /** * Returns the encoding type of the form. * This will be either "multipart/form-data"" if there are any {@link FileField} instances, @@ -662,6 +679,16 @@ class Form extends RequestHandler { function getRecord() { return $this->record; } + + /** + * Get the legend value to be inserted into the + * element in Form.ss + * + * @return string + */ + function getLegend() { + return $this->legend; + } /** * Processing that occurs before a form is executed. diff --git a/templates/Includes/Form.ss b/templates/Includes/Form.ss index a117dd85c..ccc563112 100644 --- a/templates/Includes/Form.ss +++ b/templates/Includes/Form.ss @@ -7,7 +7,7 @@ <% end_if %>
- + $Legend <% control Fields %> $FieldHolder <% end_control %>