Skip to content

Commit

Permalink
MINOR: Ensure all form fields have FieldHolder() with identical signa…
Browse files Browse the repository at this point in the history
…ture to FormField::FieldHolder(). Fixes E_STRICT warnings.
  • Loading branch information
andrewandante committed Apr 11, 2012
1 parent 142a073 commit 716ff9d
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion forms/ComplexTableField.php
Expand Up @@ -206,7 +206,7 @@ function isComposite() {
/**
* @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");
Expand Down
2 changes: 1 addition & 1 deletion forms/CompositeField.php
Expand Up @@ -158,7 +158,7 @@ public function Field($properties = array()) {
/**
* Returns the fields nested inside another DIV
*/
function FieldHolder() {
function FieldHolder($properties = array()) {
$content = '';

if($this->tag == 'fieldset' && $this->legend) {
Expand Down
4 changes: 2 additions & 2 deletions forms/DatalessField.php
Expand Up @@ -32,8 +32,8 @@ function getAttributes() {
* 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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion forms/DateField.php
Expand Up @@ -110,7 +110,7 @@ function __construct($name, $title = null, $value = null) {
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();
Expand Down
4 changes: 2 additions & 2 deletions forms/DatetimeField.php
Expand Up @@ -74,14 +74,14 @@ function setForm($form) {
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()) {
Expand Down
2 changes: 1 addition & 1 deletion forms/FieldGroup.php
Expand Up @@ -131,7 +131,7 @@ function setZebra($zebra) {
return $this;
}

function FieldHolder() {
function FieldHolder($properties = array()) {
$Title = $this->XML_val('Title');
$Message = $this->XML_val('Message');
$MessageType = $this->XML_val('MessageType');
Expand Down
4 changes: 2 additions & 2 deletions forms/FormAction.php
Expand Up @@ -70,8 +70,8 @@ function Field($properties = array()) {
return $this->customise($properties)->renderWith($this->getTemplate());
}

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

public function Type() {
Expand Down
4 changes: 2 additions & 2 deletions forms/HasManyComplexTableField.php
Expand Up @@ -64,8 +64,8 @@ function __construct($controller, $name, $sourceClass, $fieldList = null, $detai

}

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");
Expand Down
4 changes: 2 additions & 2 deletions forms/HiddenField.php
Expand Up @@ -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() {
Expand Down
13 changes: 10 additions & 3 deletions forms/LiteralField.php
Expand Up @@ -27,12 +27,19 @@ function __construct($name, $content) {
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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion forms/PrintableTransformation.php
Expand Up @@ -25,7 +25,7 @@ function __construct($tabs) {
CompositeField::__construct($tabs);
}

function FieldHolder() {
function FieldHolder($properties = array()) {
// This gives us support for sub-tabs.
$tag = ($this->tabSet) ? "h2>" : "h1>";

Expand Down
6 changes: 4 additions & 2 deletions forms/SelectionGroup.php
Expand Up @@ -85,12 +85,14 @@ function hasData() {
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);
}
}

5 changes: 3 additions & 2 deletions forms/TabSet.php
Expand Up @@ -69,7 +69,7 @@ public function id() {
* 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');
Expand All @@ -80,7 +80,8 @@ public function FieldHolder() {

Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js');

return $this->renderWith($this->template);
$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions forms/TableField.php
Expand Up @@ -463,7 +463,7 @@ function getExtraData() {
/**
* 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');
Expand All @@ -472,7 +472,8 @@ function FieldHolder() {
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) {
Expand Down
6 changes: 4 additions & 2 deletions forms/TableListField.php
Expand Up @@ -278,7 +278,7 @@ function handleItem($request) {
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');
Expand All @@ -299,7 +299,9 @@ function FieldHolder() {
});
JS
);}
return $this->renderWith($this->template);

$obj = $properties ? $this->customise($properties) : $this;
return $obj->renderWith($this->template);
}

function Headings() {
Expand Down
5 changes: 3 additions & 2 deletions forms/ToggleCompositeField.php
Expand Up @@ -22,12 +22,13 @@ function __construct($name, $title, $children) {
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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions forms/gridfield/GridField.php
Expand Up @@ -289,7 +289,7 @@ public function getState($getData=true) {
*
* @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');

Expand Down Expand Up @@ -449,7 +449,7 @@ public function FieldHolder() {
}

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

public function getAttributes() {
Expand Down

0 comments on commit 716ff9d

Please sign in to comment.