diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 9374ab003..49cd9544f 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -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"); diff --git a/forms/CompositeField.php b/forms/CompositeField.php index d19086af4..dbb540c4c 100644 --- a/forms/CompositeField.php +++ b/forms/CompositeField.php @@ -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) { diff --git a/forms/DatalessField.php b/forms/DatalessField.php index cafdef336..68a081772 100644 --- a/forms/DatalessField.php +++ b/forms/DatalessField.php @@ -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); } /** diff --git a/forms/DateField.php b/forms/DateField.php index 576a1fd8b..b6d94a5fa 100644 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -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(); diff --git a/forms/DatetimeField.php b/forms/DatetimeField.php index 167d82332..c939cbf2d 100644 --- a/forms/DatetimeField.php +++ b/forms/DatetimeField.php @@ -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()) { diff --git a/forms/FieldGroup.php b/forms/FieldGroup.php index a6f135a58..be1476f72 100644 --- a/forms/FieldGroup.php +++ b/forms/FieldGroup.php @@ -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'); diff --git a/forms/FormAction.php b/forms/FormAction.php index 7e52f7c8f..9c04a9f30 100644 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -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() { diff --git a/forms/HasManyComplexTableField.php b/forms/HasManyComplexTableField.php index 9f6c660d4..f0078e2b5 100644 --- a/forms/HasManyComplexTableField.php +++ b/forms/HasManyComplexTableField.php @@ -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"); diff --git a/forms/HiddenField.php b/forms/HiddenField.php index 1e33b080f..ddb9ff9c0 100644 --- a/forms/HiddenField.php +++ b/forms/HiddenField.php @@ -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() { diff --git a/forms/LiteralField.php b/forms/LiteralField.php index d99170025..0ce883757 100644 --- a/forms/LiteralField.php +++ b/forms/LiteralField.php @@ -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); } /** diff --git a/forms/PrintableTransformation.php b/forms/PrintableTransformation.php index 3e1739176..c74d52901 100644 --- a/forms/PrintableTransformation.php +++ b/forms/PrintableTransformation.php @@ -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>"; diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php index b742d5d3b..b2aabefdc 100644 --- a/forms/SelectionGroup.php +++ b/forms/SelectionGroup.php @@ -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); } } diff --git a/forms/TabSet.php b/forms/TabSet.php index 90bdd394d..defcfbe52 100644 --- a/forms/TabSet.php +++ b/forms/TabSet.php @@ -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); } /** diff --git a/forms/TableField.php b/forms/TableField.php index 0f365bab2..0d202ccc8 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -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) { diff --git a/forms/TableListField.php b/forms/TableListField.php index f20180d24..768283637 100644 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -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() { diff --git a/forms/ToggleCompositeField.php b/forms/ToggleCompositeField.php index 9fd73036f..02607baba 100644 --- a/forms/ToggleCompositeField.php +++ b/forms/ToggleCompositeField.php @@ -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); } /** diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index 4ea749231..9ac434201 100755 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -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() {