From a78b5a2efbb983cd776e8b4612f09fb8cff90a4b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 21 Oct 2008 20:58:11 +0000 Subject: [PATCH] BUGFIX Fixed extra class addition on various FormField->Field() methods git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64601 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/AjaxUniqueTextField.php | 2 +- forms/AutocompleteTextField.php | 2 +- forms/CheckboxField.php | 4 ++-- forms/ConfirmedFormAction.php | 2 +- forms/DropdownField.php | 2 +- forms/FormAction.php | 4 ++-- forms/TextField.php | 2 +- forms/TextareaField.php | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/forms/AjaxUniqueTextField.php b/forms/AjaxUniqueTextField.php index 14b7b3a82..8e9c66ea0 100644 --- a/forms/AjaxUniqueTextField.php +++ b/forms/AjaxUniqueTextField.php @@ -40,7 +40,7 @@ class AjaxUniqueTextField extends TextField { $attributes = array( 'type' => 'text', - 'class' => $this->extraClass() . " text", + 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'value' => $this->Value(), diff --git a/forms/AutocompleteTextField.php b/forms/AutocompleteTextField.php index a07b3bbfc..5626902b8 100644 --- a/forms/AutocompleteTextField.php +++ b/forms/AutocompleteTextField.php @@ -21,7 +21,7 @@ class AutocompleteTextField extends TextField { function Field() { // Requirements::javascript(SAPPHIRE_DIR . '/javascript/AutocompleteTextField.js'); $attributes = array( - 'class' => "{$this->class} text " . $this->extraClass(), + 'class' => "{$this->class} text" . ($this->extraClass() ? $this->extraClass() : ''), 'type' => 'text', 'id' => $this->id(), 'name' => $this->name, diff --git a/forms/CheckboxField.php b/forms/CheckboxField.php index 19e9a9fcf..864304f2d 100755 --- a/forms/CheckboxField.php +++ b/forms/CheckboxField.php @@ -16,7 +16,7 @@ class CheckboxField extends FormField { function Field() { $attributes = array( 'type' => 'checkbox', - 'class' => $this->extraClass(), + 'class' => ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'value' => 1, @@ -117,7 +117,7 @@ class CheckboxField_Disabled extends CheckboxField { function Field() { $attributes = array( 'type' => 'checkbox', - 'class' => $this->extraClass() . " text", + 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'tabindex' => $this->getTabIndex(), diff --git a/forms/ConfirmedFormAction.php b/forms/ConfirmedFormAction.php index 01cce6794..b8f7cb787 100755 --- a/forms/ConfirmedFormAction.php +++ b/forms/ConfirmedFormAction.php @@ -28,7 +28,7 @@ class ConfirmedFormAction extends FormAction { function Field() { $attributes = array( 'type' => 'submit', - 'class' => $this->extraClass(), + 'class' => ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'value' => $this->attrTitle(), diff --git a/forms/DropdownField.php b/forms/DropdownField.php index 067b08862..bf0b267c1 100755 --- a/forms/DropdownField.php +++ b/forms/DropdownField.php @@ -89,7 +89,7 @@ class DropdownField extends FormField { } $attributes = array( - 'class' => trim($this->extraClass()) ? $this->extraClass() : null, + 'class' => ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->name, 'tabindex' => $this->getTabIndex() diff --git a/forms/FormAction.php b/forms/FormAction.php index 3d1a96f15..ce136bd54 100755 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -64,7 +64,7 @@ class FormAction extends FormField { function Field() { if($this->useButtonTag) { $attributes = array( - 'class' => 'action' . ($this->extraClass() ? (' ' . $this->extraClass()) : ''), + 'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'type' => 'submit', 'name' => $this->action @@ -73,7 +73,7 @@ class FormAction extends FormField { return $this->createTag('button', $attributes, $this->attrTitle()); } else { $attributes = array( - 'class' => 'action' . ($this->extraClass() ? (' ' . $this->extraClass()) : ''), + 'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'type' => 'submit', 'name' => $this->action, diff --git a/forms/TextField.php b/forms/TextField.php index a07f2d303..7850d65a0 100755 --- a/forms/TextField.php +++ b/forms/TextField.php @@ -18,7 +18,7 @@ class TextField extends FormField { function Field() { $attributes = array( 'type' => 'text', - 'class' => $this->extraClass() . ' text', + 'class' => 'text' . ($this->extraClass() ? $this->extraClass() : ''), 'id' => $this->id(), 'name' => $this->Name(), 'value' => $this->Value(), diff --git a/forms/TextareaField.php b/forms/TextareaField.php index 51483b2a8..b7edc62d3 100755 --- a/forms/TextareaField.php +++ b/forms/TextareaField.php @@ -38,7 +38,7 @@ class TextareaField extends FormField { if($this->readonly) { $attributes = array( 'id' => $this->id(), - 'class' => 'readonly' . (trim($this->extraClass()) ? (' ' . $this->extraClass()) : ''), + 'class' => 'readonly' . ($this->extraClass() ? $this->extraClass() : ''), 'name' => $this->name, 'tabindex' => $this->getTabIndex(), 'readonly' => 'readonly' @@ -53,7 +53,7 @@ class TextareaField extends FormField { } else { $attributes = array( 'id' => $this->id(), - 'class' => (trim($this->extraClass()) ? $this->extraClass() : ''), + 'class' => ($this->extraClass() ? $this->extraClass() : ''), 'name' => $this->name, 'rows' => $this->rows, 'cols' => $this->cols