1
0
mirror of https://github.com/silverstripe/silverstripe-framework synced 2024-10-22 14:05:37 +02:00

MINOR: Ensure all form fields Field() method has the same signature as FormField::Field(). Fixes E_STRICT warnings.

This commit is contained in:
Andrew O'Neil 2012-04-11 17:33:36 +12:00
parent d368f3605b
commit 4be59a8d45
27 changed files with 36 additions and 36 deletions

View File

@ -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');

View File

@ -134,7 +134,7 @@ class CompositeField extends FormField {
);
}
public function Field() {
public function Field($properties = array()) {
$content = '';
if($this->tag == 'fieldset' && $this->legend) {

View File

@ -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');

View File

@ -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, "");

View File

@ -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);

View File

@ -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').')');

View File

@ -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) {

View File

@ -92,7 +92,7 @@ class FieldGroup extends CompositeField {
* @todo Shouldn't use SmallFieldHolder() (very difficult to style),
* it is easier to overwrite the <div class="field"> 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}\"" : '';

View File

@ -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');

View File

@ -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)) {

View File

@ -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 "<span class=\"readonly typography\" id=\"" . $this->id() . "\">" . ( $this->value && $this->value != '<p></p>' ? $this->value : '<i>(not set)</i>' ) . "</span><input type=\"hidden\" name=\"".$this->name."\" value=\"".$valforInput."\" />";
}

View File

@ -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');

View File

@ -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 "<input type=\"submit\" name=\"action_{$this->name}\" value=\"{$this->title}\" id=\"{$this->id()}\" disabled=\"disabled\" class=\"action disabled$this->extraClass\" />";
}

View File

@ -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();
}

View File

@ -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();

View File

@ -5,7 +5,7 @@
*/
class MemberDatetimeOptionsetField extends OptionsetField {
function Field() {
function Field($properties = array()) {
$options = '';
$odd = 0;
$source = $this->getSource();

View File

@ -43,7 +43,7 @@ class MoneyField extends FormField {
/**
* @return string
*/
function Field() {
function Field($properties = array()) {
return "<div class=\"fieldgroup\">" .
"<div class=\"fieldgroupField\">" . $this->fieldCurrency->SmallFieldHolder() . "</div>" .
"<div class=\"fieldgroupField\">" . $this->fieldAmount->SmallFieldHolder() . "</div>" .

View File

@ -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 {

View File

@ -7,7 +7,7 @@
*/
class NumericField extends TextField{
function Field() {
function Field($properties = array()) {
$html = parent::Field();
Requirements::javascript(SAPPHIRE_DIR . 'javascript/NumericField.js');

View File

@ -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();

View File

@ -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;

View File

@ -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 {

View File

@ -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");

View File

@ -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()) {

View File

@ -310,7 +310,7 @@ class UploadField extends FileField {
);
}
public function Field() {
public function Field($properties = array()) {
$record = $this->getRecord();
$name = $this->getName();

View File

@ -448,7 +448,7 @@ class GridField extends FormField {
);
}
public function Field() {
public function Field($properties = array()) {
return $this->FieldHolder();
}

View File

@ -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');