Skip to content

Commit

Permalink
MINOR: Ensure all form fields Field() method has the same signature a…
Browse files Browse the repository at this point in the history
…s FormField::Field(). Fixes E_STRICT warnings.
  • Loading branch information
andrewandante committed Apr 11, 2012
1 parent d368f36 commit 4be59a8
Show file tree
Hide file tree
Showing 27 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion forms/AjaxUniqueTextField.php
Expand Up @@ -28,7 +28,7 @@ function __construct($name, $title, $restrictedField, $restrictedTable, $value =
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');
Expand Down
2 changes: 1 addition & 1 deletion forms/CompositeField.php
Expand Up @@ -134,7 +134,7 @@ function getAttributes() {
);
}

public function Field() {
public function Field($properties = array()) {
$content = '';

if($this->tag == 'fieldset' && $this->legend) {
Expand Down
2 changes: 1 addition & 1 deletion forms/ConfirmedPasswordField.php
Expand Up @@ -93,7 +93,7 @@ function __construct($name, $title = null, $value = "", $form = null, $showOnCli
$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');
Expand Down
2 changes: 1 addition & 1 deletion forms/CreditCardField.php
Expand Up @@ -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, "");
Expand Down
4 changes: 2 additions & 2 deletions forms/CurrencyField.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions forms/DateField.php
Expand Up @@ -120,7 +120,7 @@ function FieldHolder() {
return $html;
}

function Field() {
function Field($properties = array()) {
$config = array(
'showcalendar' => $this->getConfig('showcalendar'),
'isoDateformat' => $this->getConfig('dateformat'),
Expand Down Expand Up @@ -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').')');
Expand Down
4 changes: 2 additions & 2 deletions forms/DatetimeField.php
Expand Up @@ -84,7 +84,7 @@ function FieldHolder() {
return parent::FieldHolder();
}

function Field() {
function Field($properties = array()) {
Requirements::css(SAPPHIRE_DIR . '/css/DatetimeField.css');

$tzField = ($this->getConfig('usertimezone')) ? $this->timezoneField->FieldHolder() : '';
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion forms/FieldGroup.php
Expand Up @@ -92,7 +92,7 @@ function Name(){
* @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}\"" : '';
Expand Down
2 changes: 1 addition & 1 deletion forms/FileIFrameField.php
Expand Up @@ -60,7 +60,7 @@ public function dataClass() {
/**
* @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');
Expand Down
2 changes: 1 addition & 1 deletion forms/GroupedDropdownField.php
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions forms/HtmlEditorField.php
Expand Up @@ -56,7 +56,7 @@ public function __construct($name, $title = null, $value = '') {
/**
* @return string
*/
function Field() {
function Field($properties = array()) {
// mark up broken links
$value = new SS_HTMLValue($this->value);

Expand Down Expand Up @@ -221,7 +221,7 @@ public function performDisabledTransformation() {
* @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."\" />";
}
Expand Down
2 changes: 1 addition & 1 deletion forms/ImageFormAction.php
Expand Up @@ -26,7 +26,7 @@ function __construct($action, $title = "", $image = "", $hoverImage = null, $cla
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');

Expand Down
4 changes: 2 additions & 2 deletions forms/InlineFormAction.php
Expand Up @@ -27,7 +27,7 @@ function performReadonlyTransformation() {
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()));
}
Expand Down Expand Up @@ -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\" />";
}

Expand Down
2 changes: 1 addition & 1 deletion forms/LiteralField.php
Expand Up @@ -31,7 +31,7 @@ function FieldHolder() {
return is_object($this->content) ? $this->content->forTemplate() : $this->content;
}

function Field() {
function Field($properties = array()) {
return $this->FieldHolder();
}

Expand Down
2 changes: 1 addition & 1 deletion forms/LookupField.php
Expand Up @@ -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();


Expand Down
2 changes: 1 addition & 1 deletion forms/MemberDatetimeOptionsetField.php
Expand Up @@ -5,7 +5,7 @@
*/
class MemberDatetimeOptionsetField extends OptionsetField {

function Field() {
function Field($properties = array()) {
$options = '';
$odd = 0;
$source = $this->getSource();
Expand Down
2 changes: 1 addition & 1 deletion forms/MoneyField.php
Expand Up @@ -43,7 +43,7 @@ function __construct($name, $title = null, $value = "") {
/**
* @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>" .
Expand Down
2 changes: 1 addition & 1 deletion forms/NullableField.php
Expand Up @@ -76,7 +76,7 @@ function getIsNullId() {
* (non-PHPdoc)
* @see sapphire/forms/FormField#Field()
*/
function Field() {
function Field($properties = array()) {
if ( $this->isReadonly()) {
$nullableCheckbox = new CheckboxField_Readonly($this->getIsNullId());
} else {
Expand Down
2 changes: 1 addition & 1 deletion forms/NumericField.php
Expand Up @@ -7,7 +7,7 @@
*/
class NumericField extends TextField{

function Field() {
function Field($properties = array()) {
$html = parent::Field();
Requirements::javascript(SAPPHIRE_DIR . 'javascript/NumericField.js');

Expand Down
2 changes: 1 addition & 1 deletion forms/PhoneNumberField.php
Expand Up @@ -26,7 +26,7 @@ public function __construct( $name, $title = null, $value = '', $extension = nul
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();
Expand Down
4 changes: 2 additions & 2 deletions forms/SimpleImageField.php
Expand Up @@ -78,7 +78,7 @@ function __construct($name, $title = null, $value = null) {
$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) {
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions forms/TimeField.php
Expand Up @@ -63,13 +63,13 @@ function __construct($name, $title = null, $value = ""){
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() {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion forms/ToggleField.php
Expand Up @@ -46,7 +46,7 @@ function __construct($name, $title = "", $value = "") {
parent::__construct($name, $title, $value);
}

function Field() {
function Field($properties = array()) {
$content = '';

Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
Expand Down
4 changes: 2 additions & 2 deletions forms/TreeMultiselectField.php
Expand Up @@ -78,7 +78,7 @@ function getItems() {
* 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');
Expand Down Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion forms/UploadField.php
Expand Up @@ -310,7 +310,7 @@ public function getAttributes() {
);
}

public function Field() {
public function Field($properties = array()) {
$record = $this->getRecord();
$name = $this->getName();

Expand Down
2 changes: 1 addition & 1 deletion forms/gridfield/GridField.php
Expand Up @@ -448,7 +448,7 @@ public function FieldHolder() {
);
}

public function Field() {
public function Field($properties = array()) {
return $this->FieldHolder();
}

Expand Down
2 changes: 1 addition & 1 deletion security/PermissionCheckboxSetField.php
Expand Up @@ -70,7 +70,7 @@ function getHiddenPermissions() {
return $this->hiddenPermissions;
}

function Field() {
function Field($properties = array()) {
Requirements::css(SAPPHIRE_DIR . '/css/CheckboxSetField.css');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');

Expand Down

0 comments on commit 4be59a8

Please sign in to comment.