From 4be59a8d4583ab8bbc4e102cf0c43725616f33c2 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Wed, 11 Apr 2012 17:33:36 +1200 Subject: [PATCH] MINOR: Ensure all form fields Field() method has the same signature as FormField::Field(). Fixes E_STRICT warnings. --- forms/AjaxUniqueTextField.php | 2 +- forms/CompositeField.php | 2 +- forms/ConfirmedPasswordField.php | 2 +- forms/CreditCardField.php | 2 +- forms/CurrencyField.php | 4 ++-- forms/DateField.php | 4 ++-- forms/DatetimeField.php | 4 ++-- forms/FieldGroup.php | 2 +- forms/FileIFrameField.php | 2 +- forms/GroupedDropdownField.php | 2 +- forms/HtmlEditorField.php | 4 ++-- forms/ImageFormAction.php | 2 +- forms/InlineFormAction.php | 4 ++-- forms/LiteralField.php | 2 +- forms/LookupField.php | 2 +- forms/MemberDatetimeOptionsetField.php | 2 +- forms/MoneyField.php | 2 +- forms/NullableField.php | 2 +- forms/NumericField.php | 2 +- forms/PhoneNumberField.php | 2 +- forms/SimpleImageField.php | 4 ++-- forms/TimeField.php | 6 +++--- forms/ToggleField.php | 2 +- forms/TreeMultiselectField.php | 4 ++-- forms/UploadField.php | 2 +- forms/gridfield/GridField.php | 2 +- security/PermissionCheckboxSetField.php | 2 +- 27 files changed, 36 insertions(+), 36 deletions(-) diff --git a/forms/AjaxUniqueTextField.php b/forms/AjaxUniqueTextField.php index f8a2ad592..c9a0254cf 100644 --- a/forms/AjaxUniqueTextField.php +++ b/forms/AjaxUniqueTextField.php @@ -28,7 +28,7 @@ class AjaxUniqueTextField extends TextField { parent::__construct($name, $title, $value); } - function Field() { + function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js"); Requirements::javascript(THIRDPARTY_DIR . "/behaviour/behaviour.js"); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); diff --git a/forms/CompositeField.php b/forms/CompositeField.php index 13377a14f..d19086af4 100644 --- a/forms/CompositeField.php +++ b/forms/CompositeField.php @@ -134,7 +134,7 @@ class CompositeField extends FormField { ); } - public function Field() { + public function Field($properties = array()) { $content = ''; if($this->tag == 'fieldset' && $this->legend) { diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index cb2087019..2ee1b49df 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -93,7 +93,7 @@ class ConfirmedPasswordField extends FormField { $this->setValue($value); } - function Field() { + function Field($properties = array()) { Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/ConfirmedPasswordField.js'); Requirements::css(SAPPHIRE_DIR . '/css/ConfirmedPasswordField.css'); diff --git a/forms/CreditCardField.php b/forms/CreditCardField.php index 533b64269..bcf246095 100644 --- a/forms/CreditCardField.php +++ b/forms/CreditCardField.php @@ -6,7 +6,7 @@ */ class CreditCardField extends TextField { - function Field() { + function Field($properties = array()) { $parts = $this->value; if(!is_array($parts)) $parts = explode("\n", chunk_split($parts,4,"\n")); $parts = array_pad($parts, 4, ""); diff --git a/forms/CurrencyField.php b/forms/CurrencyField.php index 7298c8798..2d2d0ac05 100644 --- a/forms/CurrencyField.php +++ b/forms/CurrencyField.php @@ -67,7 +67,7 @@ class CurrencyField_Readonly extends ReadonlyField{ /** * overloaded to display the correctly formated value for this datatype */ - function Field() { + function Field($properties = array()) { if($this->value){ $val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value); $val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2); @@ -100,7 +100,7 @@ class CurrencyField_Disabled extends CurrencyField{ /** * overloaded to display the correctly formated value for this datatype */ - function Field() { + function Field($properties = array()) { if($this->value){ $val = $this->dontEscape ? $this->value : Convert::raw2xml($this->value); $val = _t('CurrencyField.CURRENCYSYMBOL', '$') . number_format(preg_replace('/[^0-9.]/',"",$val), 2); diff --git a/forms/DateField.php b/forms/DateField.php index 7345e6d39..576a1fd8b 100644 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -120,7 +120,7 @@ class DateField extends TextField { return $html; } - function Field() { + function Field($properties = array()) { $config = array( 'showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), @@ -425,7 +425,7 @@ class DateField_Disabled extends DateField { protected $disabled = true; - function Field() { + function Field($properties = array()) { if($this->valueObj) { if($this->valueObj->isToday()) { $val = Convert::raw2xml($this->valueObj->toString($this->getConfig('dateformat')) . ' ('._t('DateField.TODAY','today').')'); diff --git a/forms/DatetimeField.php b/forms/DatetimeField.php index ee5487dcb..167d82332 100644 --- a/forms/DatetimeField.php +++ b/forms/DatetimeField.php @@ -84,7 +84,7 @@ class DatetimeField extends FormField { return parent::FieldHolder(); } - function Field() { + function Field($properties = array()) { Requirements::css(SAPPHIRE_DIR . '/css/DatetimeField.css'); $tzField = ($this->getConfig('usertimezone')) ? $this->timezoneField->FieldHolder() : ''; @@ -287,7 +287,7 @@ class DatetimeField_Readonly extends DatetimeField { protected $readonly = true; - function Field() { + function Field($properties = array()) { $valDate = $this->dateField->dataValue(); $valTime = $this->timeField->dataValue(); if($valDate && $valTime) { diff --git a/forms/FieldGroup.php b/forms/FieldGroup.php index f16f1ed32..a6f135a58 100644 --- a/forms/FieldGroup.php +++ b/forms/FieldGroup.php @@ -92,7 +92,7 @@ class FieldGroup extends CompositeField { * @todo Shouldn't use SmallFieldHolder() (very difficult to style), * it is easier to overwrite the
behaviour in a more specific class */ - function Field() { + function Field($properties = array()) { $fs = $this->FieldList(); $spaceZebra = isset($this->zebra) ? " fieldgroup-$this->zebra" : ''; $idAtt = isset($this->id) ? " id=\"{$this->id}\"" : ''; diff --git a/forms/FileIFrameField.php b/forms/FileIFrameField.php index f23d255bb..e4345a7e7 100644 --- a/forms/FileIFrameField.php +++ b/forms/FileIFrameField.php @@ -60,7 +60,7 @@ class FileIFrameField extends FileField { /** * @return string */ - public function Field() { + public function Field($properties = array()) { Deprecation::notice('3.0', 'Use UploadField'); Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css'); diff --git a/forms/GroupedDropdownField.php b/forms/GroupedDropdownField.php index 3708cf277..a4037affd 100644 --- a/forms/GroupedDropdownField.php +++ b/forms/GroupedDropdownField.php @@ -39,7 +39,7 @@ */ class GroupedDropdownField extends DropdownField { - function Field() { + function Field($properties = array()) { $options = ''; foreach($this->getSource() as $value => $title) { if(is_array($title)) { diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 290a96bcb..dc0e24deb 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -56,7 +56,7 @@ class HtmlEditorField extends TextareaField { /** * @return string */ - function Field() { + function Field($properties = array()) { // mark up broken links $value = new SS_HTMLValue($this->value); @@ -221,7 +221,7 @@ class HtmlEditorField extends TextareaField { * @subpackage fields-formattedinput */ class HtmlEditorField_Readonly extends ReadonlyField { - function Field() { + function Field($properties = array()) { $valforInput = $this->value ? Convert::raw2att($this->value) : ""; return "id() . "\">" . ( $this->value && $this->value != '

' ? $this->value : '(not set)' ) . "
name."\" value=\"".$valforInput."\" />"; } diff --git a/forms/ImageFormAction.php b/forms/ImageFormAction.php index d6dd77b10..72d9cf6e9 100644 --- a/forms/ImageFormAction.php +++ b/forms/ImageFormAction.php @@ -26,7 +26,7 @@ class ImageFormAction extends FormAction { parent::__construct($action, $title, $form); } - function Field() { + function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/ImageFormAction.js'); diff --git a/forms/InlineFormAction.php b/forms/InlineFormAction.php index f79758fbb..3e715bdb7 100644 --- a/forms/InlineFormAction.php +++ b/forms/InlineFormAction.php @@ -27,7 +27,7 @@ class InlineFormAction extends FormField { return new InlineFormAction_ReadOnly( $this->name, $this->title ); } - function Field() { + function Field($properties = array()) { if($this->includeDefaultJS) { Requirements::javascriptTemplate(SAPPHIRE_DIR . '/javascript/InlineFormAction.js',array('ID'=>$this->id())); } @@ -59,7 +59,7 @@ class InlineFormAction_ReadOnly extends FormField { protected $readonly = true; - function Field() { + function Field($properties = array()) { return "name}\" value=\"{$this->title}\" id=\"{$this->id()}\" disabled=\"disabled\" class=\"action disabled$this->extraClass\" />"; } diff --git a/forms/LiteralField.php b/forms/LiteralField.php index b7890cab1..d99170025 100644 --- a/forms/LiteralField.php +++ b/forms/LiteralField.php @@ -31,7 +31,7 @@ class LiteralField extends DatalessField { return is_object($this->content) ? $this->content->forTemplate() : $this->content; } - function Field() { + function Field($properties = array()) { return $this->FieldHolder(); } diff --git a/forms/LookupField.php b/forms/LookupField.php index 6d06f27a3..f032cf27d 100644 --- a/forms/LookupField.php +++ b/forms/LookupField.php @@ -12,7 +12,7 @@ class LookupField extends DropdownField { /** * Returns a readonly span containing the correct value. */ - function Field() { + function Field($properties = array()) { $source = $this->getSource(); diff --git a/forms/MemberDatetimeOptionsetField.php b/forms/MemberDatetimeOptionsetField.php index c8bf8031b..052249445 100644 --- a/forms/MemberDatetimeOptionsetField.php +++ b/forms/MemberDatetimeOptionsetField.php @@ -5,7 +5,7 @@ */ class MemberDatetimeOptionsetField extends OptionsetField { - function Field() { + function Field($properties = array()) { $options = ''; $odd = 0; $source = $this->getSource(); diff --git a/forms/MoneyField.php b/forms/MoneyField.php index eab6aefba..5d7fd86f5 100644 --- a/forms/MoneyField.php +++ b/forms/MoneyField.php @@ -43,7 +43,7 @@ class MoneyField extends FormField { /** * @return string */ - function Field() { + function Field($properties = array()) { return "
" . "
" . $this->fieldCurrency->SmallFieldHolder() . "
" . "
" . $this->fieldAmount->SmallFieldHolder() . "
" . diff --git a/forms/NullableField.php b/forms/NullableField.php index 8b76db967..a427223bf 100644 --- a/forms/NullableField.php +++ b/forms/NullableField.php @@ -76,7 +76,7 @@ class NullableField extends FormField { * (non-PHPdoc) * @see sapphire/forms/FormField#Field() */ - function Field() { + function Field($properties = array()) { if ( $this->isReadonly()) { $nullableCheckbox = new CheckboxField_Readonly($this->getIsNullId()); } else { diff --git a/forms/NumericField.php b/forms/NumericField.php index 0683dd454..0951076a6 100644 --- a/forms/NumericField.php +++ b/forms/NumericField.php @@ -7,7 +7,7 @@ */ class NumericField extends TextField{ - function Field() { + function Field($properties = array()) { $html = parent::Field(); Requirements::javascript(SAPPHIRE_DIR . 'javascript/NumericField.js'); diff --git a/forms/PhoneNumberField.php b/forms/PhoneNumberField.php index 4e756f7a9..0433e31c3 100644 --- a/forms/PhoneNumberField.php +++ b/forms/PhoneNumberField.php @@ -26,7 +26,7 @@ class PhoneNumberField extends FormField { parent::__construct($name, $title, $value); } - public function Field() { + public function Field($properties = array()) { $fields = new FieldGroup( $this->name ); $fields->setID("{$this->name}_Holder"); list($countryCode, $areaCode, $phoneNumber, $extension) = $this->parseValue(); diff --git a/forms/SimpleImageField.php b/forms/SimpleImageField.php index dc9d918a2..ea06fd013 100644 --- a/forms/SimpleImageField.php +++ b/forms/SimpleImageField.php @@ -78,7 +78,7 @@ class SimpleImageField extends FileField { $this->getValidator()->setAllowedExtensions(array('jpg','gif','png')); } - function Field() { + function Field($properties = array()) { if($this->form) $record = $this->form->getRecord(); $fieldName = $this->name; if(isset($record)&&$record) { @@ -141,7 +141,7 @@ class SimpleImageField_Disabled extends FormField { protected $readonly = true; - function Field() { + function Field($properties = array()) { $record = $this->form->getRecord(); $fieldName = $this->name; diff --git a/forms/TimeField.php b/forms/TimeField.php index c98881285..38b096d4a 100644 --- a/forms/TimeField.php +++ b/forms/TimeField.php @@ -63,13 +63,13 @@ class TimeField extends TextField { parent::__construct($name,$title,$value); } - function Field() { + function Field($properties = array()) { $config = array( 'timeformat' => $this->getConfig('timeformat') ); $config = array_filter($config); $this->addExtraClass(Convert::raw2json($config)); - return parent::Field(); + return parent::Field($properties); } function Type() { @@ -206,7 +206,7 @@ class TimeField_Readonly extends TimeField { protected $readonly = true; - function Field() { + function Field($properties = array()) { if($this->valueObj) { $val = Convert::raw2xml($this->valueObj->toString($this->getConfig('timeformat'))); } else { diff --git a/forms/ToggleField.php b/forms/ToggleField.php index 0e23e3904..58b9abab7 100644 --- a/forms/ToggleField.php +++ b/forms/ToggleField.php @@ -46,7 +46,7 @@ class ToggleField extends ReadonlyField { parent::__construct($name, $title, $value); } - function Field() { + function Field($properties = array()) { $content = ''; Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js"); diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index bd2755417..3c8d1eb23 100644 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -78,7 +78,7 @@ class TreeMultiselectField extends TreeDropdownField { * We overwrite the field attribute to add our hidden fields, as this * formfield can contain multiple values. */ - function Field() { + function Field($properties = array()) { Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); @@ -178,7 +178,7 @@ class TreeMultiselectField_Readonly extends TreeMultiselectField { protected $readonly = true; - function Field() { + function Field($properties = array()) { $titleArray = $itemIDs = array(); $titleList = $itemIDsList = ""; if($items = $this->getItems()) { diff --git a/forms/UploadField.php b/forms/UploadField.php index a4a3c7740..556f7dc87 100644 --- a/forms/UploadField.php +++ b/forms/UploadField.php @@ -310,7 +310,7 @@ class UploadField extends FileField { ); } - public function Field() { + public function Field($properties = array()) { $record = $this->getRecord(); $name = $this->getName(); diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index b4a4c4ad6..4ea749231 100755 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -448,7 +448,7 @@ class GridField extends FormField { ); } - public function Field() { + public function Field($properties = array()) { return $this->FieldHolder(); } diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 7c95c801e..db9027068 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -70,7 +70,7 @@ class PermissionCheckboxSetField extends FormField { return $this->hiddenPermissions; } - function Field() { + function Field($properties = array()) { Requirements::css(SAPPHIRE_DIR . '/css/CheckboxSetField.css'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');