MINOR: Ensure all form fields have FieldHolder() with identical signature to FormField::FieldHolder(). Fixes E_STRICT warnings.

This commit is contained in:
Andrew O'Neil 2012-04-11 18:07:55 +12:00
parent 142a073ce3
commit 716ff9dcfa
17 changed files with 44 additions and 30 deletions

View File

@ -206,7 +206,7 @@ class ComplexTableField extends TableListField {
/**
* @return String
*/
function FieldHolder() {
function FieldHolder($properties = array()) {
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
Requirements::javascript(THIRDPARTY_DIR . "/behaviour/behaviour.js");
Requirements::javascript(THIRDPARTY_DIR . "/greybox/AmiJS.js");

View File

@ -158,7 +158,7 @@ class CompositeField extends FormField {
/**
* Returns the fields nested inside another DIV
*/
function FieldHolder() {
function FieldHolder($properties = array()) {
$content = '';
if($this->tag == 'fieldset' && $this->legend) {

View File

@ -32,8 +32,8 @@ class DatalessField extends FormField {
* Returns the field's representation in the form.
* For dataless fields, this defaults to $Field.
*/
function FieldHolder() {
return $this->Field();
function FieldHolder($properties = array()) {
return $this->Field($properties);
}
/**

View File

@ -110,7 +110,7 @@ class DateField extends TextField {
parent::__construct($name, $title, $value);
}
function FieldHolder() {
function FieldHolder($properties = array()) {
// TODO Replace with properly extensible view helper system
$d = DateField_View_JQuery::create($this);
$d->onBeforeRender();

View File

@ -74,14 +74,14 @@ class DatetimeField extends FormField {
return $this;
}
function FieldHolder() {
function FieldHolder($properties = array()) {
$config = array(
'datetimeorder' => $this->getConfig('datetimeorder'),
);
$config = array_filter($config);
$this->addExtraClass(Convert::raw2json($config));
return parent::FieldHolder();
return parent::FieldHolder($properties);
}
function Field($properties = array()) {

View File

@ -131,7 +131,7 @@ class FieldGroup extends CompositeField {
return $this;
}
function FieldHolder() {
function FieldHolder($properties = array()) {
$Title = $this->XML_val('Title');
$Message = $this->XML_val('Message');
$MessageType = $this->XML_val('MessageType');

View File

@ -70,8 +70,8 @@ class FormAction extends FormField {
return $this->customise($properties)->renderWith($this->getTemplate());
}
function FieldHolder() {
return $this->Field();
function FieldHolder($properties = array()) {
return $this->Field($properties);
}
public function Type() {

View File

@ -64,8 +64,8 @@ class HasManyComplexTableField extends ComplexTableField {
}
function FieldHolder() {
$ret = parent::FieldHolder();
function FieldHolder($properties = array()) {
$ret = parent::FieldHolder($properties);
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
Requirements::javascript(SAPPHIRE_DIR . "/javascript/HasManyFileField.js");

View File

@ -8,8 +8,8 @@ class HiddenField extends FormField {
protected $template = 'HiddenField';
function FieldHolder() {
return $this->Field();
function FieldHolder($properties = array()) {
return $this->Field($properties);
}
function performReadonlyTransformation() {

View File

@ -27,12 +27,19 @@ class LiteralField extends DatalessField {
parent::__construct($name);
}
function FieldHolder() {
return is_object($this->content) ? $this->content->forTemplate() : $this->content;
function FieldHolder($properties = array()) {
if(is_object($this->content)) {
$obj = $this->content;
if($properties)
$obj = $obj->customise($properties);
return $obj->forTemplate();
} else {
return $this->content;
}
}
function Field($properties = array()) {
return $this->FieldHolder();
return $this->FieldHolder($properties);
}
/**

View File

@ -25,7 +25,7 @@ class PrintableTransformation_TabSet extends TabSet {
CompositeField::__construct($tabs);
}
function FieldHolder() {
function FieldHolder($properties = array()) {
// This gives us support for sub-tabs.
$tag = ($this->tabSet) ? "h2>" : "h1>";

View File

@ -85,12 +85,14 @@ class SelectionGroup extends CompositeField {
return true;
}
function FieldHolder() {
function FieldHolder($properties = array()) {
Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/SelectionGroup.js');
Requirements::css(SAPPHIRE_DIR . '/css/SelectionGroup.css');
$obj = $properties ? $this->customise($properties) : $this;
return $this->renderWith($this->template);
return $obj->renderWith($this->template);
}
}

View File

@ -69,7 +69,7 @@ class TabSet extends CompositeField {
* Returns a tab-strip and the associated tabs.
* The HTML is a standardised format, containing a <ul;
*/
public function FieldHolder() {
public function FieldHolder($properties = array()) {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js');
@ -80,7 +80,8 @@ class TabSet extends CompositeField {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js');
return $this->renderWith($this->template);
$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}
/**

View File

@ -463,7 +463,7 @@ class TableField extends TableListField {
/**
* Sets the template to be rendered with
*/
function FieldHolder() {
function FieldHolder($properties = array()) {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
@ -472,7 +472,8 @@ class TableField extends TableListField {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableField.js');
Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
return $this->renderWith($this->template);
$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}
function setTransformationConditions($conditions) {

View File

@ -278,7 +278,7 @@ class TableListField extends FormField {
return new TableListField_ItemRequest($this, $request->param('ID'));
}
function FieldHolder() {
function FieldHolder($properties = array()) {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
@ -299,7 +299,9 @@ class TableListField extends FormField {
});
JS
);}
return $this->renderWith($this->template);
$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}
function Headings() {

View File

@ -22,12 +22,13 @@ class ToggleCompositeField extends CompositeField {
parent::__construct($children);
}
public function FieldHolder() {
public function FieldHolder($properties = array()) {
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
Requirements::javascript(SAPPHIRE_DIR . "/javascript/ToggleCompositeField.js");
return $this->renderWith($this->template);
$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}
/**

View File

@ -289,7 +289,7 @@ class GridField extends FormField {
*
* @return string
*/
public function FieldHolder() {
public function FieldHolder($properties = array()) {
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(SAPPHIRE_DIR . '/css/GridField.css');
@ -449,7 +449,7 @@ class GridField extends FormField {
}
public function Field($properties = array()) {
return $this->FieldHolder();
return $this->FieldHolder($properties);
}
public function getAttributes() {