diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index e6a8c6f45..b77107498 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -120,7 +120,7 @@ class ConfirmedPasswordField extends FormField { /** * @param array $properties * - * @return string + * @return HTMLText */ public function Field($properties = array()) { Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); diff --git a/forms/DatalessField.php b/forms/DatalessField.php index 1f4b38129..97c0f07b9 100644 --- a/forms/DatalessField.php +++ b/forms/DatalessField.php @@ -31,6 +31,8 @@ class DatalessField extends FormField { /** * Returns the field's representation in the form. * For dataless fields, this defaults to $Field. + * + * @return HTMLText */ public function FieldHolder($properties = array()) { return $this->Field($properties); diff --git a/forms/DatetimeField.php b/forms/DatetimeField.php index bccbd0d6e..cff9fdbdb 100644 --- a/forms/DatetimeField.php +++ b/forms/DatetimeField.php @@ -88,7 +88,10 @@ class DatetimeField extends FormField { return $this; } - + /** + * @param array $properties + * @return HTMLText + */ public function FieldHolder($properties = array()) { $config = array( 'datetimeorder' => $this->getConfig('datetimeorder'), @@ -100,14 +103,19 @@ class DatetimeField extends FormField { return parent::FieldHolder($properties); } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { Requirements::css(FRAMEWORK_DIR . '/css/DatetimeField.css'); $tzField = ($this->getConfig('usertimezone')) ? $this->timezoneField->FieldHolder() : ''; - return $this->dateField->FieldHolder() . + return DBField::create_field('HTMLText', $this->dateField->FieldHolder() . $this->timeField->FieldHolder() . $tzField . - '
'; + '
' + ); } /** diff --git a/forms/DropdownField.php b/forms/DropdownField.php index c58aeb211..bc9f9ad46 100644 --- a/forms/DropdownField.php +++ b/forms/DropdownField.php @@ -128,6 +128,10 @@ class DropdownField extends FormField { parent::__construct($name, ($title===null) ? $name : $title, $value, $form); } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { $source = $this->getSource(); $options = array(); diff --git a/forms/FileField.php b/forms/FileField.php index 9973144df..2728539b9 100644 --- a/forms/FileField.php +++ b/forms/FileField.php @@ -83,6 +83,10 @@ class FileField extends FormField { parent::__construct($name, $title, $value); } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { $properties = array_merge($properties, array( 'MaxFileSize' => $this->getValidator()->getAllowedMaxFileSize() diff --git a/forms/FormAction.php b/forms/FormAction.php index abb9d662b..2824e6624 100644 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -49,7 +49,7 @@ class FormAction extends FormField { public function __construct($action, $title = "", $form = null) { $this->action = "action_$action"; $this->setForm($form); - + parent::__construct($this->action, $title); } @@ -74,6 +74,10 @@ class FormAction extends FormField { return $this; } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { $properties = array_merge( $properties, @@ -87,6 +91,10 @@ class FormAction extends FormField { return parent::Field($properties); } + /** + * @param array $properties + * @return HTMLText + */ public function FieldHolder($properties = array()) { return $this->Field($properties); } diff --git a/forms/HiddenField.php b/forms/HiddenField.php index 975eb5d44..052d97d5d 100644 --- a/forms/HiddenField.php +++ b/forms/HiddenField.php @@ -10,7 +10,7 @@ class HiddenField extends FormField { /** * @param array $properties * - * @return string + * @return HTMLText */ public function FieldHolder($properties = array()) { return $this->Field($properties); diff --git a/forms/InlineFormAction.php b/forms/InlineFormAction.php index 3f06ca244..4e8984876 100644 --- a/forms/InlineFormAction.php +++ b/forms/InlineFormAction.php @@ -27,14 +27,25 @@ class InlineFormAction extends FormField { return $this->castedCopy('InlineFormAction_ReadOnly'); } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { if($this->includeDefaultJS) { Requirements::javascriptTemplate(FRAMEWORK_DIR . '/javascript/InlineFormAction.js', array('ID'=>$this->id())); } - return "name}\" value=\"{$this->title}\" id=\"{$this->id()}\"" - . " class=\"action{$this->extraClass}\" />"; + return DBField::create_field( + 'HTMLText', + FormField::create('input', array( + 'name' => sprintf('action_%s', $this->getName()), + 'value' => $this->title, + 'id' => $this->ID(), + 'class' => sprintf('action%s', $this->extraClass), + )) + ); } public function Title() { @@ -61,9 +72,21 @@ class InlineFormAction_ReadOnly extends FormField { protected $readonly = true; + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { - return "name}\" value=\"{$this->title}\" id=\"{$this->id()}\"" - . " disabled=\"disabled\" class=\"action disabled$this->extraClass\" />"; + return DBField::create_field('HTMLText', + FormField::create_tag('input', array( + 'type' => 'submit', + 'name' => sprintf('action_%s', $this->name), + 'value' => $this->title, + 'id' => $this->id(), + 'disabled' => 'disabled', + 'class' => 'action disabled ' . $this->extraClass, + )) + ); } public function Title() { diff --git a/forms/MoneyField.php b/forms/MoneyField.php index 0bb3b12d0..e7f69b058 100644 --- a/forms/MoneyField.php +++ b/forms/MoneyField.php @@ -41,13 +41,16 @@ class MoneyField extends FormField { } /** - * @return string + * @param array + * @return HTMLText */ public function Field($properties = array()) { - return "
" . + return DBField::create_field('HTMLText', + "
" . "
" . $this->fieldCurrency->SmallFieldHolder() . "
" . "
" . $this->fieldAmount->SmallFieldHolder() . "
" . - "
"; + "
" + ); } /** diff --git a/forms/NullableField.php b/forms/NullableField.php index 597495914..0223601af 100644 --- a/forms/NullableField.php +++ b/forms/NullableField.php @@ -42,7 +42,6 @@ class NullableField extends FormField { */ protected $isNullLabel; - /** * Create a new nullable field * @@ -103,7 +102,7 @@ class NullableField extends FormField { /** * @param array $properties * - * @return string + * @return HTMLText */ public function Field($properties = array()) { if($this->isReadonly()) { @@ -114,12 +113,12 @@ class NullableField extends FormField { $nullableCheckbox->setValue(is_null($this->dataValue())); - return sprintf( + return DBField::create_field('HTMLText', sprintf( '%s %s %s', $this->valueField->Field(), $nullableCheckbox->Field(), $this->getIsNullLabel() - ); + )); } /** diff --git a/forms/PhoneNumberField.php b/forms/PhoneNumberField.php index 0108c307e..2fd0c5dcf 100644 --- a/forms/PhoneNumberField.php +++ b/forms/PhoneNumberField.php @@ -27,6 +27,10 @@ class PhoneNumberField extends FormField { parent::__construct($name, $title, $value); } + /** + * @param array $properties + * @return FieldGroup|HTMLText + */ public function Field($properties = array()) { $fields = new FieldGroup( $this->name ); $fields->setID("{$this->name}_Holder"); diff --git a/forms/ReadonlyField.php b/forms/ReadonlyField.php index b5a8d595f..856d1cc11 100644 --- a/forms/ReadonlyField.php +++ b/forms/ReadonlyField.php @@ -36,6 +36,10 @@ class ReadonlyField extends FormField { return clone $this; } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { // Include a hidden field in the HTML if($this->includeHiddenField && $this->readonly) { diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index e8436eced..cf3b7bf2a 100644 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -204,7 +204,7 @@ class TreeDropdownField extends FormField { } /** - * @return string + * @return HTMLText */ public function Field($properties = array()) { Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang'); diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index 6c2af9a90..c18115514 100644 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -279,7 +279,7 @@ class GridField extends FormField { * * @param array $properties * - * @return string + * @return HTMLText */ public function FieldHolder($properties = array()) { Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); @@ -501,11 +501,11 @@ class GridField extends FormField { $header . "\n" . $footer . "\n" . $body ); - return FormField::create_tag( + return DBField::create_field('HTMLText', FormField::create_tag( 'fieldset', $fieldsetAttributes, $content['before'] . $table . $content['after'] - ); + )); } /** @@ -589,7 +589,7 @@ class GridField extends FormField { /** * @param array $properties * - * @return string + * @return HTMLText */ public function Field($properties = array()) { return $this->FieldHolder($properties); diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 236b26543..4bb1cafb8 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -71,6 +71,10 @@ class PermissionCheckboxSetField extends FormField { return $this->hiddenPermissions; } + /** + * @param array $properties + * @return HTMLText + */ public function Field($properties = array()) { Requirements::css(FRAMEWORK_DIR . '/css/CheckboxSetField.css'); Requirements::javascript(FRAMEWORK_DIR . '/javascript/PermissionCheckboxSetField.js'); @@ -227,7 +231,8 @@ class PermissionCheckboxSetField extends FormField { } } if($this->readonly) { - return "\n" + ); } else { - return "\n" + ); } }