mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE: Added FieldList::forTemplate(), so that by default a FieldList will be rendered in its template as a concatenation of FieldHolder values.
API CHANGE: Removed unnecessary HiddenFieldList class.
This commit is contained in:
parent
2820b503c2
commit
e4dbf8065b
@ -539,20 +539,13 @@ class FieldList extends ArrayList {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A field list designed to store a list of hidden fields. When inserted into a template, only the
|
||||
* input tags will be included
|
||||
*
|
||||
* @package forms
|
||||
* @subpackage fields-structural
|
||||
*/
|
||||
class HiddenFieldList extends FieldList {
|
||||
/**
|
||||
* Default template rendering of a FieldList will concatenate all FieldHolder values.
|
||||
*/
|
||||
function forTemplate() {
|
||||
$output = "";
|
||||
foreach($this as $field) {
|
||||
$output .= $field->Field();
|
||||
$output .= $field->FieldHolder();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@ -715,6 +715,19 @@ class FieldListTest extends SapphireTest {
|
||||
unset($set);
|
||||
}
|
||||
|
||||
/**
|
||||
* FieldList::forTemplate() returns a concatenation of FieldHolder values.
|
||||
*/
|
||||
function testForTemplate() {
|
||||
$set = new FieldList(
|
||||
$a = new TextField('A'),
|
||||
$b = new TextField('B')
|
||||
);
|
||||
|
||||
$this->assertEquals($a->FieldHolder() . $b->FieldHolder(), $set->forTempalte());
|
||||
|
||||
}
|
||||
|
||||
function testMakeFieldReadonly() {
|
||||
$FieldList = new FieldList(
|
||||
new TabSet('Root', new Tab('Main',
|
||||
|
Loading…
Reference in New Issue
Block a user