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 "