diff --git a/admin/code/GroupImportForm.php b/admin/code/GroupImportForm.php index 3cab0c7d3..01e33264b 100644 --- a/admin/code/GroupImportForm.php +++ b/admin/code/GroupImportForm.php @@ -35,7 +35,7 @@ class GroupImportForm extends Form { $importSpec = $importer->getImportSpec(); $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields']))); - $fields = new FieldSet( + $fields = new FieldList( new LiteralField('Help', $helpHtml), $fileField = new FileField( 'CsvFile', @@ -48,7 +48,7 @@ class GroupImportForm extends Form { $fileField->getValidator()->setAllowedExtensions(array('csv')); } - if(!$actions) $actions = new FieldSet( + if(!$actions) $actions = new FieldList( new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import')) ); diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index d07b0eb25..b18083b37 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -746,7 +746,7 @@ class LeftAndMain extends Controller { * Calls {@link SiteTree->getCMSFields()} * * @param Int $id - * @param FieldSet $fields + * @param FieldList $fields * @return Form */ public function getEditForm($id = null, $fields = null) { @@ -847,7 +847,7 @@ class LeftAndMain extends Controller { $form = new Form( $this, "EditForm", - new FieldSet( + new FieldList( // new HeaderField( // 'WelcomeHeader', // $this->getApplicationName() @@ -861,7 +861,7 @@ class LeftAndMain extends Controller { // ) // ) ), - new FieldSet() + new FieldList() ); $form->unsetValidator(); $form->addExtraClass('cms-edit-form'); @@ -881,10 +881,10 @@ class LeftAndMain extends Controller { $form = new Form( $this, 'AddForm', - new FieldSet( + new FieldList( new HiddenField('ParentID') ), - new FieldSet( + new FieldList( $addAction = new FormAction('doAdd', _t('AssetAdmin_left.ss.GO','Go')) ) ); @@ -949,7 +949,7 @@ class LeftAndMain extends Controller { $form = new Form( $this, 'BatchActionsForm', - new FieldSet( + new FieldList( new HiddenField('csvIDs'), new DropdownField( 'Action', @@ -957,7 +957,7 @@ class LeftAndMain extends Controller { $actionsMap ) ), - new FieldSet( + new FieldList( // TODO i18n new FormAction('submit', "Go") ) diff --git a/admin/code/MemberImportForm.php b/admin/code/MemberImportForm.php index af288852b..b84397df4 100644 --- a/admin/code/MemberImportForm.php +++ b/admin/code/MemberImportForm.php @@ -34,7 +34,7 @@ class MemberImportForm extends Form { $importSpec = $importer->getImportSpec(); $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields']))); - $fields = new FieldSet( + $fields = new FieldList( new LiteralField('Help', $helpHtml), $fileField = new FileField( 'CsvFile', @@ -47,7 +47,7 @@ class MemberImportForm extends Form { $fileField->getValidator()->setAllowedExtensions(array('csv')); } - if(!$actions) $actions = new FieldSet( + if(!$actions) $actions = new FieldList( new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import')) ); diff --git a/admin/code/MemberTableField.php b/admin/code/MemberTableField.php index 863b81999..f64fd6f26 100644 --- a/admin/code/MemberTableField.php +++ b/admin/code/MemberTableField.php @@ -228,7 +228,7 @@ class MemberTableField extends ComplexTableField { * Add existing member to group by name (with JS-autocompletion) */ function AddRecordForm() { - $fields = new FieldSet(); + $fields = new FieldList(); foreach($this->FieldList() as $fieldName => $fieldTitle) { // If we're adding the set password field, we want to hide the text from any peeping eyes if($fieldName == 'SetPassword') { @@ -240,7 +240,7 @@ class MemberTableField extends ComplexTableField { if($this->group) { $fields->push(new HiddenField('ctf[ID]', null, $this->group->ID)); } - $actions = new FieldSet( + $actions = new FieldList( new FormAction('addtogroup', _t('MemberTableField.ADD','Add')) ); diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index 2eab7a7e9..53db227a0 100755 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -402,7 +402,7 @@ class ModelAdmin_CollectionController extends Controller { $form = new Form($this, "SearchForm", $fields, - new FieldSet( + new FieldList( new FormAction('search', _t('MemberTableField.SEARCH', 'Search')), $clearAction = new ResetFormAction('clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search')) ), @@ -434,8 +434,8 @@ class ModelAdmin_CollectionController extends Controller { $buttonLabel = sprintf(_t('ModelAdmin.CREATEBUTTON', "Create '%s'", PR_MEDIUM, "Create a new instance from a model class"), singleton($modelName)->i18n_singular_name()); $form = new Form($this, "CreateForm", - new FieldSet(), - new FieldSet($createButton = new FormAction('add', $buttonLabel)), + new FieldList(), + new FieldList($createButton = new FormAction('add', $buttonLabel)), $validator = new RequiredFields() ); $createButton->addExtraClass('ss-ui-action-constructive'); @@ -467,7 +467,7 @@ class ModelAdmin_CollectionController extends Controller { if(!singleton($modelName)->canCreate(Member::currentUser())) return false; - $fields = new FieldSet( + $fields = new FieldList( new HiddenField('ClassName', _t('ModelAdmin.CLASSTYPE'), $modelName), new FileField('_CsvFile', false) ); @@ -493,7 +493,7 @@ class ModelAdmin_CollectionController extends Controller { $fields->push(new LiteralField("SpecFor{$modelName}", $specHTML)); $fields->push(new CheckboxField('EmptyBeforeImport', 'Clear Database before import', false)); - $actions = new FieldSet( + $actions = new FieldList( new FormAction('import', _t('ModelAdmin.IMPORT', 'Import from CSV')) ); @@ -766,11 +766,11 @@ class ModelAdmin_CollectionController extends Controller { $form = new Form( $this, 'ResultsForm', - new FieldSet( + new FieldList( new HeaderField('SearchResults', _t('ModelAdmin.SEARCHRESULTS','Search Results'), 2), $tf ), - new FieldSet() + new FieldList() ); // Include the search criteria on the results form URL, but not dodgy variables like those below @@ -839,7 +839,7 @@ class ModelAdmin_CollectionController extends Controller { if(!$validator) $validator = new RequiredFields(); $validator->setJavascriptValidationHandler('none'); - $actions = new FieldSet ( + $actions = new FieldList ( new FormAction("doCreate", _t('ModelAdmin.ADDBUTTON', "Add")) ); @@ -1030,7 +1030,7 @@ class ModelAdmin_RecordController extends Controller { */ public function ViewForm() { $fields = $this->currentRecord->getCMSFields(); - $form = new Form($this, "EditForm", $fields, new FieldSet()); + $form = new Form($this, "EditForm", $fields, new FieldList()); $form->loadDataFrom($this->currentRecord); $form->makeReadonly(); return $form; diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index 0e68649ab..f1ac5815a 100644 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -110,7 +110,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { // unset 'inlineadd' permission, we don't want inline addition $memberList->setPermissions(array('edit', 'delete', 'add')); - $fields = new FieldSet( + $fields = new FieldList( new TabSet( 'Root', new Tab('Members', singleton('Member')->i18n_plural_name(), @@ -155,7 +155,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { $rolesTab->push($rolesCTF); } - $actions = new FieldSet( + $actions = new FieldList( new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')) ); diff --git a/admin/tests/MemberTableFieldTest.php b/admin/tests/MemberTableFieldTest.php index e665dc1df..f61edd47c 100644 --- a/admin/tests/MemberTableFieldTest.php +++ b/admin/tests/MemberTableFieldTest.php @@ -116,8 +116,8 @@ class MemberTableFieldTest_Controller extends Controller implements TestOnly { return new Form( $this, 'FormNoGroup', - new FieldSet(new MemberTableField($this, "Members", $group1)), - new FieldSet(new FormAction('submit')) + new FieldList(new MemberTableField($this, "Members", $group1)), + new FieldList(new FormAction('submit')) ); } @@ -131,8 +131,8 @@ class MemberTableFieldTest_Controller extends Controller implements TestOnly { return new Form( $this, 'FormNoGroup', - new FieldSet(new MemberTableField($this, "Members")), - new FieldSet(new FormAction('submit')) + new FieldList(new MemberTableField($this, "Members")), + new FieldList(new FormAction('submit')) ); } diff --git a/filesystem/File.php b/filesystem/File.php index c07a267b3..c4e8311cd 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -779,7 +779,7 @@ class File extends DataObject { * @return FieldSet */ function uploadMetadataFields() { - $fields = new FieldSet(); + $fields = new FieldList(); $fields->push(new TextField('Title', $this->fieldLabel('Title'))); $this->extend('updateUploadMetadataFields', $fields); diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 0ad64b3ea..86b00eae4 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -386,7 +386,7 @@ class Folder extends File { /** * Return the FieldSet used to edit this folder in the CMS. * You can modify this fieldset by subclassing folder, or by creating a {@link DataExtension} - * and implemeting updateCMSFields(FieldSet $fields) on that extension. + * and implemeting updateCMSFields(FieldList $fields) on that extension. */ function getCMSFields() { $fileList = new AssetTableField( @@ -407,7 +407,7 @@ class Folder extends File { $deleteButton = new HiddenField('deletemarked'); } - $fields = new FieldSet( + $fields = new FieldList( new HiddenField("Name"), new TabSet("Root", new Tab("Files", _t('Folder.FILESTAB', "Files"), diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index aba398a5e..062836486 100644 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -189,7 +189,7 @@ class ComplexTableField extends TableListField { * @param string $name * @param string $sourceClass * @param array $fieldList - * @param FieldSet $detailFormFields + * @param FieldList $detailFormFields * @param string $sourceFilter * @param string $sourceSort * @param string $sourceJoin @@ -331,7 +331,7 @@ JS; * @return FieldSet */ function createFieldSet() { - $fieldset = new FieldSet(); + $fieldset = new FieldList(); foreach($this->fieldTypes as $key => $fieldType){ $fieldset->push(new $fieldType($key)); } @@ -813,7 +813,7 @@ class ComplexTableField_Popup extends Form { Requirements::clear(); Requirements::unblock_all(); - $actions = new FieldSet(); + $actions = new FieldList(); if(!$readonly) { $actions->push( $saveAction = new FormAction( diff --git a/forms/CompositeField.php b/forms/CompositeField.php index 6936a3efa..2e0e2c041 100755 --- a/forms/CompositeField.php +++ b/forms/CompositeField.php @@ -9,7 +9,7 @@ class CompositeField extends FormField { /** - * @var FieldSet + * @var FieldList */ protected $children; @@ -29,13 +29,13 @@ class CompositeField extends FormField { protected $columnCount = null; public function __construct($children = null) { - if($children instanceof FieldSet) { + if($children instanceof FieldList) { $this->children = $children; } elseif(is_array($children)) { - $this->children = new FieldSet($children); + $this->children = new FieldList($children); } else { $children = is_array(func_get_args()) ? func_get_args() : array(); - $this->children = new FieldSet($children); + $this->children = new FieldList($children); } $this->children->setContainerField($this); @@ -46,12 +46,19 @@ class CompositeField extends FormField { } /** - * Returns all the sub-fields, suitable for <% control FieldSet %> + * Returns all the sub-fields, suitable for <% control FieldList %> */ - public function FieldSet() { + public function FieldList() { return $this->children; } - + + /** + * @deprecated 3.0 Please use {@link FieldList()}. + */ + public function FieldSet() { + return $this->FieldList(); + } + public function setID($id) { $this->id = $id; } @@ -62,14 +69,14 @@ class CompositeField extends FormField { /** * Accessor method for $this->children - * @return FieldSet + * @return FieldList */ public function getChildren() { return $this->children; } /** - * @param FieldSet $children + * @param FieldList $children */ public function setChildren($children) { $this->children = $children; @@ -79,7 +86,7 @@ class CompositeField extends FormField { * Returns the fields nested inside another DIV */ function FieldHolder() { - $fs = $this->FieldSet(); + $fs = $this->FieldList(); $idAtt = isset($this->id) ? " id=\"{$this->id}\"" : ''; $className = ($this->columnCount) ? "field CompositeField {$this->extraClass()} multicolumn" : "field CompositeField {$this->extraClass()}"; $content = "
'. _t('HtmlEditorField.SHOWUPLOADFORM', 'Upload File') .'
'), new FileField("Files[0]" , _t('AssetAdmin.CHOOSEFILE','Choose file: ')), new LiteralField('Response', ''), @@ -327,7 +327,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { ) ); - $actions = new FieldSet( + $actions = new FieldList( new FormAction('insertimage', _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert image')) ); @@ -359,7 +359,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { $form = new Form( $this->controller, "{$this->name}/FlashForm", - new FieldSet( + new FieldList( new LiteralField( 'Heading', sprintf('
* function Form() {
- * return new Form($this, "Form", new FieldSet(
+ * return new Form($this, "Form", new FieldList(
* new SimpleImageField (
* $name = "FileTypeID",
* $title = "Upload your FileType"
* )
- * ), new FieldSet(
+ * ), new FieldList(
*
* // List the action buttons here - doform executes the function 'doform' below
* new FormAction("doform", "Submit")
diff --git a/forms/TableField.php b/forms/TableField.php
index 7c1e36fd6..12bca602f 100644
--- a/forms/TableField.php
+++ b/forms/TableField.php
@@ -217,7 +217,7 @@ class TableField extends TableListField {
$this,
null,
$this->FieldSetForRow(),
- new FieldSet()
+ new FieldList()
);
$form->loadDataFrom($dataObj);
@@ -281,7 +281,7 @@ class TableField extends TableListField {
* @return FieldSet
*/
function FieldSetForRow() {
- $fieldset = new FieldSet();
+ $fieldset = new FieldList();
if($this->fieldTypes){
foreach($this->fieldTypes as $key => $fieldType) {
if(isset($fieldType->class) && is_subclass_of($fieldType, 'FormField')) {
@@ -360,7 +360,7 @@ class TableField extends TableListField {
}
}
- $form = new Form($this, null, $fieldset, new FieldSet());
+ $form = new Form($this, null, $fieldset, new FieldList());
foreach ($dataObjects as $objectid => $fieldValues) {
// 'new' counts as an empty column, don't save it
@@ -592,7 +592,7 @@ JS;
class TableField_Item extends TableListField_Item {
/**
- * @var FieldSet $fields
+ * @var FieldList $fields
*/
protected $fields;
@@ -719,7 +719,7 @@ class TableField_Item extends TableListField_Item {
$i++;
}
}
- return new FieldSet($this->fields);
+ return new FieldList($this->fields);
}
function Fields() {
diff --git a/model/DataExtension.php b/model/DataExtension.php
index e62ec8f16..15fcf4557 100755
--- a/model/DataExtension.php
+++ b/model/DataExtension.php
@@ -160,11 +160,11 @@ abstract class DataExtension extends Extension {
* should just be used to add or modify tabs, or fields which
* are specific to the CMS-context.
*
- * Caution: Use {@link FieldSet->addFieldToTab()} to add fields.
+ * Caution: Use {@link FieldList->addFieldToTab()} to add fields.
*
- * @param FieldSet $fields FieldSet with a contained TabSet
+ * @param FieldList $fields FieldSet with a contained TabSet
*/
- function updateCMSFields(FieldSet &$fields) {
+ function updateCMSFields(FieldList $fields) {
}
/**
@@ -173,18 +173,18 @@ abstract class DataExtension extends Extension {
*
* Caution: Use {@link FieldSet->push()} to add fields.
*
- * @param FieldSet $fields FieldSet without TabSet nesting
+ * @param FieldList $fields FieldSet without TabSet nesting
*/
- function updateFrontEndFields(FieldSet &$fields) {
+ function updateFrontEndFields(FieldList $fields) {
}
/**
* This is used to provide modifications to the form actions
* used in the CMS. {@link DataObject->getCMSActions()}.
*
- * @param FieldSet $actions FieldSet
+ * @param FieldList $actions FieldSet
*/
- function updateCMSActions(FieldSet &$actions) {
+ function updateCMSActions(FieldList $actions) {
}
/**
diff --git a/model/DataObject.php b/model/DataObject.php
index e1b9aff55..644a19327 100644
--- a/model/DataObject.php
+++ b/model/DataObject.php
@@ -1782,7 +1782,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
),
(array)$_params
);
- $fields = new FieldSet();
+ $fields = new FieldList();
foreach($this->searchableFields() as $fieldName => $spec) {
if($params['restrictFields'] && !in_array($fieldName, $params['restrictFields'])) continue;
@@ -1899,7 +1899,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* @return an Empty FieldSet(); need to be overload by solid subclass
*/
public function getCMSActions() {
- $actions = new FieldSet();
+ $actions = new FieldList();
$this->extend('updateCMSActions', $actions);
return $actions;
}
diff --git a/search/SearchContext.php b/search/SearchContext.php
index ca4be07c2..1a5406f1d 100644
--- a/search/SearchContext.php
+++ b/search/SearchContext.php
@@ -63,14 +63,14 @@ class SearchContext extends Object {
*
* @param string $modelClass The base {@link DataObject} class that search properties related to.
* Also used to generate a set of result objects based on this class.
- * @param FieldSet $fields Optional. FormFields mapping to {@link DataObject::$db} properties
+ * @param FieldList $fields Optional. FormFields mapping to {@link DataObject::$db} properties
* which are to be searched. Derived from modelclass using
* {@link DataObject::scaffoldSearchFields()} if left blank.
* @param array $filters Optional. Derived from modelclass if left blank
*/
function __construct($modelClass, $fields = null, $filters = null) {
$this->modelClass = $modelClass;
- $this->fields = ($fields) ? $fields : new FieldSet();
+ $this->fields = ($fields) ? $fields : new FieldList();
$this->filters = ($filters) ? $filters : array();
parent::__construct();
@@ -241,7 +241,7 @@ class SearchContext extends Object {
/**
* Apply a list of searchable fields to the current search context.
*
- * @param FieldSet $fields
+ * @param FieldList $fields
*/
public function setFields($fields) {
$this->fields = $fields;
diff --git a/security/ChangePasswordForm.php b/security/ChangePasswordForm.php
index 50e9bfd7d..7e933b6d9 100755
--- a/security/ChangePasswordForm.php
+++ b/security/ChangePasswordForm.php
@@ -27,7 +27,7 @@ class ChangePasswordForm extends Form {
}
if(!$fields) {
- $fields = new FieldSet();
+ $fields = new FieldList();
// Security/changepassword?h=XXX redirects to Security/changepassword
// without GET parameter to avoid potential HTTP referer leakage.
@@ -40,7 +40,7 @@ class ChangePasswordForm extends Form {
$fields->push(new PasswordField("NewPassword2", _t('Member.CONFIRMNEWPASSWORD', "Confirm New Password")));
}
if(!$actions) {
- $actions = new FieldSet(
+ $actions = new FieldList(
new FormAction("doChangePassword", _t('Member.BUTTONCHANGEPASSWORD', "Change Password"))
);
}
diff --git a/security/Group.php b/security/Group.php
index 2f5416406..ebc5581cb 100644
--- a/security/Group.php
+++ b/security/Group.php
@@ -62,7 +62,7 @@ class Group extends DataObject {
public function getCMSFields() {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
- $fields = new FieldSet(
+ $fields = new FieldList(
new TabSet("Root",
new Tab('Members', _t('SecurityAdmin.MEMBERS', 'Members'),
new TextField("Title", $this->fieldLabel('Title')),
diff --git a/security/Member.php b/security/Member.php
index d646a0fca..074c4adcc 100644
--- a/security/Member.php
+++ b/security/Member.php
@@ -1570,7 +1570,7 @@ class Member_ProfileForm extends Form {
$fields = $member->getCMSFields();
$fields->push(new HiddenField('ID','ID',$member->ID));
- $actions = new FieldSet(
+ $actions = new FieldList(
new FormAction('dosave',_t('CMSMain.SAVE', 'Save'))
);
diff --git a/security/MemberLoginForm.php b/security/MemberLoginForm.php
index d46a10dea..f88b88bc2 100644
--- a/security/MemberLoginForm.php
+++ b/security/MemberLoginForm.php
@@ -50,16 +50,16 @@ class MemberLoginForm extends LoginForm {
}
if($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) {
- $fields = new FieldSet(
+ $fields = new FieldList(
new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this)
);
- $actions = new FieldSet(
+ $actions = new FieldList(
new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else"))
);
} else {
if(!$fields) {
$label=singleton('Member')->fieldLabel(Member::get_unique_identifier_field());
- $fields = new FieldSet(
+ $fields = new FieldList(
new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this),
//Regardless of what the unique identifer field is (usually 'Email'), it will be held in the 'Email' value, below:
new TextField("Email", $label, Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
@@ -73,7 +73,7 @@ class MemberLoginForm extends LoginForm {
}
}
if(!$actions) {
- $actions = new FieldSet(
+ $actions = new FieldList(
new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")),
new LiteralField(
'forgotPassword',
diff --git a/security/Security.php b/security/Security.php
index afc8662be..8505be676 100644
--- a/security/Security.php
+++ b/security/Security.php
@@ -470,10 +470,10 @@ class Security extends Controller {
return Object::create('MemberLoginForm',
$this,
'LostPasswordForm',
- new FieldSet(
+ new FieldList(
new EmailField('Email', _t('Member.EMAIL', 'Email'))
),
- new FieldSet(
+ new FieldList(
new FormAction(
'forgotPassword',
_t('Security.BUTTONSEND', 'Send me the password reset link')
diff --git a/security/SecurityToken.php b/security/SecurityToken.php
index 964c47de4..c1a996ddb 100644
--- a/security/SecurityToken.php
+++ b/security/SecurityToken.php
@@ -164,7 +164,7 @@ class SecurityToken extends Object {
* on the returned {@link HiddenField}, you'll need to take
* care of this yourself.
*
- * @param FieldSet $fieldset
+ * @param FieldList $fieldset
* @return HiddenField|false
*/
function updateFieldSet(&$fieldset) {
@@ -234,7 +234,7 @@ class NullSecurityToken extends SecurityToken {
}
/**
- * @param FieldSet $fieldset
+ * @param FieldList $fieldset
* @return false
*/
function updateFieldSet(&$fieldset) {
diff --git a/tests/control/RequestHandlingTest.php b/tests/control/RequestHandlingTest.php
index 23e4f1ea9..9420d29f3 100755
--- a/tests/control/RequestHandlingTest.php
+++ b/tests/control/RequestHandlingTest.php
@@ -298,10 +298,10 @@ class RequestHandlingTest_Controller extends Controller implements TestOnly {
}
function TestForm() {
- return new RequestHandlingTest_Form($this, "TestForm", new FieldSet(
+ return new RequestHandlingTest_Form($this, "TestForm", new FieldList(
new RequestHandlingTest_FormField("MyField"),
new RequestHandlingTest_SubclassedFormField("SubclassedField")
- ), new FieldSet(
+ ), new FieldList(
new FormAction("myAction")
));
}
@@ -350,10 +350,10 @@ class RequestHandlingTest_FormActionController extends Controller {
return new Form(
$this,
"Form",
- new FieldSet(
+ new FieldList(
new TextField("MyField")
),
- new FieldSet(
+ new FieldList(
new FormAction("formaction"),
new FormAction('formactionInAllowedActions')
)
@@ -472,8 +472,8 @@ class RequestHandlingTest_ControllerFormWithAllowedActions extends Controller im
return new RequestHandlingTest_FormWithAllowedActions(
$this,
'Form',
- new FieldSet(),
- new FieldSet(
+ new FieldList(),
+ new FieldList(
new FormAction('allowedformaction'),
new FormAction('disallowedformaction') // disallowed through $allowed_actions in form
)
diff --git a/tests/forms/CheckboxSetFieldTest.php b/tests/forms/CheckboxSetFieldTest.php
index 11b80e459..994b0e04d 100644
--- a/tests/forms/CheckboxSetFieldTest.php
+++ b/tests/forms/CheckboxSetFieldTest.php
@@ -117,8 +117,8 @@ class CheckboxSetFieldTest extends SapphireTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet($field),
- new FieldSet()
+ new FieldList($field),
+ new FieldList()
);
$form->loadDataFrom($articleWithTags);
$this->assertEquals(
diff --git a/tests/forms/ComplexTableFieldTest.php b/tests/forms/ComplexTableFieldTest.php
index a4620cefd..68e20272c 100644
--- a/tests/forms/ComplexTableFieldTest.php
+++ b/tests/forms/ComplexTableFieldTest.php
@@ -108,11 +108,11 @@ class ComplexTableFieldTest_Controller extends Controller {
$form = new Form(
$this,
'ManyManyForm',
- new FieldSet(
+ new FieldList(
new HiddenField('ID', '', $team->ID),
$playersField
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit', 'Submit')
)
);
@@ -137,11 +137,11 @@ class ComplexTableFieldTest_Controller extends Controller {
$form = new Form(
$this,
'HasManyForm',
- new FieldSet(
+ new FieldList(
new HiddenField('ID', '', $team->ID),
$sponsorsField
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit', 'Submit')
)
);
diff --git a/tests/forms/DatetimeFieldTest.php b/tests/forms/DatetimeFieldTest.php
index 6456c7921..7a922eca8 100644
--- a/tests/forms/DatetimeFieldTest.php
+++ b/tests/forms/DatetimeFieldTest.php
@@ -22,10 +22,10 @@ class DatetimeFieldTest extends SapphireTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
$f = new DatetimeField('MyDatetime', null)
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit')
)
);
diff --git a/tests/forms/FieldSetTest.php b/tests/forms/FieldListTest.php
similarity index 78%
rename from tests/forms/FieldSetTest.php
rename to tests/forms/FieldListTest.php
index d1e0a4e21..7191a67c2 100644
--- a/tests/forms/FieldSetTest.php
+++ b/tests/forms/FieldListTest.php
@@ -1,34 +1,34 @@
setValues()}. Need to check
+ * @todo test for {@link FieldList->setValues()}. Need to check
* that the values that were set are the correct ones given back.
- * @todo test for {@link FieldSet->transform()} and {@link FieldSet->makeReadonly()}.
- * Need to ensure that it correctly transforms the FieldSet object.
- * @todo test for {@link FieldSet->HiddenFields()}. Need to check
+ * @todo test for {@link FieldList->transform()} and {@link FieldList->makeReadonly()}.
+ * Need to ensure that it correctly transforms the FieldList object.
+ * @todo test for {@link FieldList->HiddenFields()}. Need to check
* the fields returned are the correct HiddenField objects for a
- * given FieldSet instance.
- * @todo test for {@link FieldSet->dataFields()}.
- * @todo test for {@link FieldSet->findOrMakeTab()}.
+ * given FieldList instance.
+ * @todo test for {@link FieldList->dataFields()}.
+ * @todo test for {@link FieldList->findOrMakeTab()}.
* @todo the same as above with insertBefore() and insertAfter()
*
*/
-class FieldSetTest extends SapphireTest {
+class FieldListTest extends SapphireTest {
/**
* Test adding a field to a tab in a set.
*/
function testAddFieldToTab() {
- $fields = new FieldSet();
+ $fields = new FieldList();
$tab = new Tab('Root');
$fields->push($tab);
- /* We add field objects to the FieldSet, using two different methods */
+ /* We add field objects to the FieldList, using two different methods */
$fields->addFieldToTab('Root', new TextField('Country'));
$fields->addFieldsToTab('Root', array(
new EmailField('Email'),
@@ -53,7 +53,7 @@ class FieldSetTest extends SapphireTest {
* Test removing a single field from a tab in a set.
*/
function testRemoveSingleFieldFromTab() {
- $fields = new FieldSet();
+ $fields = new FieldList();
$tab = new Tab('Root');
$fields->push($tab);
@@ -71,7 +71,7 @@ class FieldSetTest extends SapphireTest {
}
function testRemoveTab() {
- $fields = new FieldSet(new TabSet(
+ $fields = new FieldList(new TabSet(
'Root',
$tab1 = new Tab('Tab1'),
$tab2 = new Tab('Tab2'),
@@ -85,12 +85,12 @@ class FieldSetTest extends SapphireTest {
}
function testHasTabSet() {
- $untabbedFields = new FieldSet(
+ $untabbedFields = new FieldList(
new TextField('Field1')
);
$this->assertFalse($untabbedFields->hasTabSet());
- $tabbedFields = new FieldSet(
+ $tabbedFields = new FieldList(
new TabSet('Root',
new Tab('Tab1')
)
@@ -102,7 +102,7 @@ class FieldSetTest extends SapphireTest {
* Test removing an array of fields from a tab in a set.
*/
function testRemoveMultipleFieldsFromTab() {
- $fields = new FieldSet();
+ $fields = new FieldList();
$tab = new Tab('Root');
$fields->push($tab);
@@ -131,9 +131,9 @@ class FieldSetTest extends SapphireTest {
* Test removing a field from a set by it's name.
*/
function testRemoveFieldByName() {
- $fields = new FieldSet();
+ $fields = new FieldList();
- /* First of all, we add a field into our FieldSet object */
+ /* First of all, we add a field into our FieldList object */
$fields->push(new TextField('Name', 'Your name'));
/* We have 1 field in our set now */
@@ -150,7 +150,7 @@ class FieldSetTest extends SapphireTest {
* Test replacing a field with another one.
*/
function testReplaceField() {
- $fields = new FieldSet();
+ $fields = new FieldList();
$tab = new Tab('Root');
$fields->push($tab);
@@ -168,7 +168,7 @@ class FieldSetTest extends SapphireTest {
}
function testRenameField() {
- $fields = new FieldSet();
+ $fields = new FieldList();
$nameField = new TextField('Name', 'Before title');
$fields->push($nameField);
@@ -186,8 +186,8 @@ class FieldSetTest extends SapphireTest {
}
function testReplaceAFieldInADifferentTab() {
- /* A FieldSet gets created with a TabSet and some field objects */
- $fieldSet = new FieldSet(
+ /* A FieldList gets created with a TabSet and some field objects */
+ $FieldList = new FieldList(
new TabSet('Root', $main = new Tab('Main',
new TextField('A'),
new TextField('B')
@@ -197,8 +197,8 @@ class FieldSetTest extends SapphireTest {
))
);
- /* The field "A" gets added to the FieldSet we just created created */
- $fieldSet->addFieldToTab('Root.Other', $newA = new TextField('A', 'New Title'));
+ /* The field "A" gets added to the FieldList we just created created */
+ $FieldList->addFieldToTab('Root.Other', $newA = new TextField('A', 'New Title'));
/* The field named "A" has been removed from the Main tab to make way for our new field named "A" in Other tab. */
$this->assertEquals(1, $main->Fields()->Count());
@@ -209,7 +209,7 @@ class FieldSetTest extends SapphireTest {
* Test finding a field that's inside a tabset, within another tab.
*/
function testNestedTabsFindingFieldByName() {
- $fields = new FieldSet();
+ $fields = new FieldList();
/* 2 tabs get created within a TabSet inside our set */
$tab = new TabSet('Root',
@@ -241,7 +241,7 @@ class FieldSetTest extends SapphireTest {
}
function testTabTitles() {
- $set = new FieldSet(
+ $set = new FieldList(
$rootTabSet = new TabSet('Root',
$tabSetWithoutTitle = new TabSet('TabSetWithoutTitle'),
$tabSetWithTitle = new TabSet('TabSetWithTitle', 'My TabSet Title',
@@ -281,10 +281,10 @@ class FieldSetTest extends SapphireTest {
/**
* Test pushing a field to a set.
*
- * This tests {@link FieldSet->push()}.
+ * This tests {@link FieldList->push()}.
*/
function testPushFieldToSet() {
- $fields = new FieldSet();
+ $fields = new FieldList();
/* A field named Country is added to the set */
$fields->push(new TextField('Country'));
@@ -310,10 +310,10 @@ class FieldSetTest extends SapphireTest {
/**
* Test inserting a field before another in a set.
*
- * This tests {@link FieldSet->insertBefore()}.
+ * This tests {@link FieldList->insertBefore()}.
*/
function testInsertBeforeFieldToSet() {
- $fields = new FieldSet();
+ $fields = new FieldList();
/* 3 fields are added to the set */
$fields->push(new TextField('Country'));
@@ -337,7 +337,7 @@ class FieldSetTest extends SapphireTest {
}
function testInsertBeforeMultipleFields() {
- $fields = new FieldSet(
+ $fields = new FieldList(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A"),
@@ -363,7 +363,7 @@ class FieldSetTest extends SapphireTest {
* Test inserting a field after another in a set.
*/
function testInsertAfterFieldToSet() {
- $fields = new FieldSet();
+ $fields = new FieldList();
/* 3 fields are added to the set */
$fields->push(new TextField('Country'));
@@ -379,16 +379,16 @@ class FieldSetTest extends SapphireTest {
/* The field we just added actually exists in the set */
$this->assertNotNull($fields->dataFieldByName('Title'));
- /* We now have 4 fields in the FieldSet */
+ /* We now have 4 fields in the FieldList */
$this->assertEquals(4, $fields->Count());
/* The position of the Title field should be at number 2 */
$this->assertEquals('Title', $fields[1]->Name());
}
- function testRootFieldSet() {
- /* Given a nested set of FormField, CompositeField, and FieldSet objects */
- $fieldSet = new FieldSet(
+ function testrootFieldSet() {
+ /* Given a nested set of FormField, CompositeField, and FieldList objects */
+ $FieldList = new FieldList(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A"),
@@ -397,27 +397,27 @@ class FieldSetTest extends SapphireTest {
)
);
- /* rootFieldSet() should always evaluate to the same object: the topmost fieldset */
- $this->assertSame($fieldSet, $fieldSet->rootFieldSet());
- $this->assertSame($fieldSet, $root->rootFieldSet());
- $this->assertSame($fieldSet, $main->rootFieldSet());
- $this->assertSame($fieldSet, $a->rootFieldSet());
- $this->assertSame($fieldSet, $b->rootFieldSet());
+ /* rootFieldSet() should always evaluate to the same object: the topmost FieldList */
+ $this->assertSame($FieldList, $FieldList->rootFieldSet());
+ $this->assertSame($FieldList, $root->rootFieldSet());
+ $this->assertSame($FieldList, $main->rootFieldSet());
+ $this->assertSame($FieldList, $a->rootFieldSet());
+ $this->assertSame($FieldList, $b->rootFieldSet());
/* If we push additional fields, they should also have the same rootFieldSet() */
$root->push($other = new Tab("Other"));
$other->push($c = new TextField("C"));
$root->push($third = new Tab("Third", $d = new TextField("D")));
- $this->assertSame($fieldSet, $other->rootFieldSet());
- $this->assertSame($fieldSet, $third->rootFieldSet());
- $this->assertSame($fieldSet, $c->rootFieldSet());
- $this->assertSame($fieldSet, $d->rootFieldSet());
+ $this->assertSame($FieldList, $other->rootFieldSet());
+ $this->assertSame($FieldList, $third->rootFieldSet());
+ $this->assertSame($FieldList, $c->rootFieldSet());
+ $this->assertSame($FieldList, $d->rootFieldSet());
}
function testAddingDuplicateReplacesOldField() {
- /* Given a nested set of FormField, CompositeField, and FieldSet objects */
- $fieldSet = new FieldSet(
+ /* Given a nested set of FormField, CompositeField, and FieldList objects */
+ $FieldList = new FieldList(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A"),
@@ -430,27 +430,27 @@ class FieldSetTest extends SapphireTest {
$newA = new TextField("A", "New A");
$newB = new TextField("B", "New B");
- $fieldSet->addFieldToTab("Root.Main", $newA);
- $fieldSet->addFieldToTab("Root.Other", $newB);
+ $FieldList->addFieldToTab("Root.Main", $newA);
+ $FieldList->addFieldToTab("Root.Other", $newB);
- $this->assertSame($newA, $fieldSet->dataFieldByName("A"));
- $this->assertSame($newB, $fieldSet->dataFieldByName("B"));
+ $this->assertSame($newA, $FieldList->dataFieldByName("A"));
+ $this->assertSame($newB, $FieldList->dataFieldByName("B"));
$this->assertEquals(1, $main->Fields()->Count());
/* Pushing fields on the end of the field set should remove them from the tab */
$thirdA = new TextField("A", "Third A");
$thirdB = new TextField("B", "Third B");
- $fieldSet->push($thirdA);
- $fieldSet->push($thirdB);
+ $FieldList->push($thirdA);
+ $FieldList->push($thirdB);
- $this->assertSame($thirdA, $fieldSet->fieldByName("A"));
- $this->assertSame($thirdB, $fieldSet->fieldByName("B"));
+ $this->assertSame($thirdA, $FieldList->fieldByName("A"));
+ $this->assertSame($thirdB, $FieldList->fieldByName("B"));
$this->assertEquals(0, $main->Fields()->Count());
}
function testAddingFieldToNonExistentTabCreatesThatTab() {
- $fieldSet = new FieldSet(
+ $FieldList = new FieldList(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A")
@@ -459,13 +459,13 @@ class FieldSetTest extends SapphireTest {
);
/* Add a field to a non-existent tab, and it will be created */
- $fieldSet->addFieldToTab("Root.Other", $b = new TextField("B"));
- $this->assertNotNull($fieldSet->fieldByName('Root')->fieldByName('Other'));
- $this->assertSame($b, $fieldSet->fieldByName('Root')->fieldByName('Other')->Fields()->First());
+ $FieldList->addFieldToTab("Root.Other", $b = new TextField("B"));
+ $this->assertNotNull($FieldList->fieldByName('Root')->fieldByName('Other'));
+ $this->assertSame($b, $FieldList->fieldByName('Root')->fieldByName('Other')->Fields()->First());
}
function testAddingFieldToATabWithTheSameNameAsTheField() {
- $fieldSet = new FieldSet(
+ $FieldList = new FieldList(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A")
@@ -475,13 +475,13 @@ class FieldSetTest extends SapphireTest {
/* If you have a tab with the same name as the field, then technically it's a duplicate. However, it's allowed because
tab isn't a data field. Only duplicate data fields are problematic */
- $fieldSet->addFieldToTab("Root.MyName", $myName = new TextField("MyName"));
- $this->assertNotNull($fieldSet->fieldByName('Root')->fieldByName('MyName'));
- $this->assertSame($myName, $fieldSet->fieldByName('Root')->fieldByName('MyName')->Fields()->First());
+ $FieldList->addFieldToTab("Root.MyName", $myName = new TextField("MyName"));
+ $this->assertNotNull($FieldList->fieldByName('Root')->fieldByName('MyName'));
+ $this->assertSame($myName, $FieldList->fieldByName('Root')->fieldByName('MyName')->Fields()->First());
}
function testInsertBeforeWithNestedCompositeFields() {
- $fieldSet = new FieldSet(
+ $FieldList = new FieldList(
new TextField('A_pre'),
new TextField('A'),
new TextField('A_post'),
@@ -497,34 +497,34 @@ class FieldSetTest extends SapphireTest {
)
);
- $fieldSet->insertBefore(
+ $FieldList->insertBefore(
$A_insertbefore = new TextField('A_insertbefore'),
'A'
);
$this->assertSame(
$A_insertbefore,
- $fieldSet->dataFieldByName('A_insertbefore'),
- 'Field on toplevel fieldset can be inserted'
+ $FieldList->dataFieldByName('A_insertbefore'),
+ 'Field on toplevel FieldList can be inserted'
);
- $fieldSet->insertBefore(
+ $FieldList->insertBefore(
$B_insertbefore = new TextField('B_insertbefore'),
'B'
);
$this->assertSame(
- $fieldSet->dataFieldByName('B_insertbefore'),
+ $FieldList->dataFieldByName('B_insertbefore'),
$B_insertbefore,
- 'Field on one nesting level fieldset can be inserted'
+ 'Field on one nesting level FieldList can be inserted'
);
- $fieldSet->insertBefore(
+ $FieldList->insertBefore(
$C_insertbefore = new TextField('C_insertbefore'),
'C'
);
$this->assertSame(
- $fieldSet->dataFieldByName('C_insertbefore'),
+ $FieldList->dataFieldByName('C_insertbefore'),
$C_insertbefore,
- 'Field on two nesting levels fieldset can be inserted'
+ 'Field on two nesting levels FieldList can be inserted'
);
}
@@ -532,7 +532,7 @@ class FieldSetTest extends SapphireTest {
* @todo check actual placement of fields
*/
function testInsertBeforeWithNestedTabsets() {
- $fieldSetA = new FieldSet(
+ $FieldListA = new FieldList(
$tabSetA = new TabSet('TabSet_A',
$tabA1 = new Tab('Tab_A1',
new TextField('A_pre'),
@@ -549,7 +549,7 @@ class FieldSetTest extends SapphireTest {
'A'
);
$this->assertEquals(
- $fieldSetA->dataFieldByName('A_insertbefore'),
+ $FieldListA->dataFieldByName('A_insertbefore'),
$A_insertbefore,
'Field on toplevel tab can be inserted'
);
@@ -559,7 +559,7 @@ class FieldSetTest extends SapphireTest {
$this->assertEquals(2, $tabA1->fieldPosition('A'));
$this->assertEquals(3, $tabA1->fieldPosition('A_post'));
- $fieldSetB = new FieldSet(
+ $FieldListB = new FieldList(
new TabSet('TabSet_A',
$tabsetB = new TabSet('TabSet_B',
$tabB1 = new Tab('Tab_B1',
@@ -573,12 +573,12 @@ class FieldSetTest extends SapphireTest {
)
)
);
- $fieldSetB->insertBefore(
+ $FieldListB->insertBefore(
$B_insertbefore = new TextField('B_insertbefore'),
'B'
);
$this->assertSame(
- $fieldSetB->dataFieldByName('B_insertbefore'),
+ $FieldListB->dataFieldByName('B_insertbefore'),
$B_insertbefore,
'Field on nested tab can be inserted'
);
@@ -589,7 +589,7 @@ class FieldSetTest extends SapphireTest {
}
function testInsertAfterWithNestedCompositeFields() {
- $fieldSet = new FieldSet(
+ $FieldList = new FieldList(
new TextField('A_pre'),
new TextField('A'),
new TextField('A_post'),
@@ -605,34 +605,34 @@ class FieldSetTest extends SapphireTest {
)
);
- $fieldSet->insertAfter(
+ $FieldList->insertAfter(
$A_insertafter = new TextField('A_insertafter'),
'A'
);
$this->assertSame(
$A_insertafter,
- $fieldSet->dataFieldByName('A_insertafter'),
- 'Field on toplevel fieldset can be inserted after'
+ $FieldList->dataFieldByName('A_insertafter'),
+ 'Field on toplevel FieldList can be inserted after'
);
- $fieldSet->insertAfter(
+ $FieldList->insertAfter(
$B_insertafter = new TextField('B_insertafter'),
'B'
);
$this->assertSame(
- $fieldSet->dataFieldByName('B_insertafter'),
+ $FieldList->dataFieldByName('B_insertafter'),
$B_insertafter,
- 'Field on one nesting level fieldset can be inserted after'
+ 'Field on one nesting level FieldList can be inserted after'
);
- $fieldSet->insertAfter(
+ $FieldList->insertAfter(
$C_insertafter = new TextField('C_insertafter'),
'C'
);
$this->assertSame(
- $fieldSet->dataFieldByName('C_insertafter'),
+ $FieldList->dataFieldByName('C_insertafter'),
$C_insertafter,
- 'Field on two nesting levels fieldset can be inserted after'
+ 'Field on two nesting levels FieldList can be inserted after'
);
}
@@ -640,7 +640,7 @@ class FieldSetTest extends SapphireTest {
* @todo check actual placement of fields
*/
function testInsertAfterWithNestedTabsets() {
- $fieldSetA = new FieldSet(
+ $FieldListA = new FieldList(
$tabSetA = new TabSet('TabSet_A',
$tabA1 = new Tab('Tab_A1',
new TextField('A_pre'),
@@ -657,7 +657,7 @@ class FieldSetTest extends SapphireTest {
'A'
);
$this->assertEquals(
- $fieldSetA->dataFieldByName('A_insertafter'),
+ $FieldListA->dataFieldByName('A_insertafter'),
$A_insertafter,
'Field on toplevel tab can be inserted after'
);
@@ -666,7 +666,7 @@ class FieldSetTest extends SapphireTest {
$this->assertEquals(2, $tabA1->fieldPosition('A_insertafter'));
$this->assertEquals(3, $tabA1->fieldPosition('A_post'));
- $fieldSetB = new FieldSet(
+ $FieldListB = new FieldList(
new TabSet('TabSet_A',
$tabsetB = new TabSet('TabSet_B',
$tabB1 = new Tab('Tab_B1',
@@ -680,12 +680,12 @@ class FieldSetTest extends SapphireTest {
)
)
);
- $fieldSetB->insertAfter(
+ $FieldListB->insertAfter(
$B_insertafter = new TextField('B_insertafter'),
'B'
);
$this->assertSame(
- $fieldSetB->dataFieldByName('B_insertafter'),
+ $FieldListB->dataFieldByName('B_insertafter'),
$B_insertafter,
'Field on nested tab can be inserted after'
);
@@ -696,7 +696,7 @@ class FieldSetTest extends SapphireTest {
}
function testFieldPosition() {
- $set = new FieldSet(
+ $set = new FieldList(
new TextField('A'),
new TextField('B'),
new TextField('C')
@@ -716,17 +716,17 @@ class FieldSetTest extends SapphireTest {
}
function testMakeFieldReadonly() {
- $fieldSet = new FieldSet(
+ $FieldList = new FieldList(
new TabSet('Root', new Tab('Main',
new TextField('A'),
new TextField('B')
)
));
- $fieldSet->makeFieldReadonly('A');
+ $FieldList->makeFieldReadonly('A');
$this->assertTrue(
- $fieldSet->dataFieldByName('A')->isReadonly(),
- 'Field nested inside a TabSet and FieldSet can be marked readonly by FieldSet->makeFieldReadonly()'
+ $FieldList->dataFieldByName('A')->isReadonly(),
+ 'Field nested inside a TabSet and FieldList can be marked readonly by FieldList->makeFieldReadonly()'
);
}
}
diff --git a/tests/forms/FileFieldTest.php b/tests/forms/FileFieldTest.php
index b9630739c..160a3ef10 100644
--- a/tests/forms/FileFieldTest.php
+++ b/tests/forms/FileFieldTest.php
@@ -12,10 +12,10 @@ class FileFieldTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
$fileField = new FileField('cv', 'Upload your CV')
),
- new FieldSet()
+ new FieldList()
);
$fileFieldValue = array(
'name' => 'aCV.txt',
@@ -38,10 +38,10 @@ class FileFieldTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
$fileField = new FileField('cv', 'Upload your CV')
),
- new FieldSet(),
+ new FieldList(),
new RequiredFields('cv')
);
// All fields are filled but for some reason an error occured when uploading the file => fails
diff --git a/tests/forms/FormScaffolderTest.php b/tests/forms/FormScaffolderTest.php
index 48a0e9a8a..3da9c0446 100644
--- a/tests/forms/FormScaffolderTest.php
+++ b/tests/forms/FormScaffolderTest.php
@@ -20,7 +20,7 @@ class FormScaffolderTest extends SapphireTest {
function testGetCMSFieldsSingleton() {
$fields = singleton('FormScaffolderTest_Article')->getCMSFields();
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom(singleton('FormScaffolderTest_Article'));
$this->assertTrue($fields->hasTabSet(), 'getCMSFields() produces a TabSet');
@@ -34,7 +34,7 @@ class FormScaffolderTest extends SapphireTest {
$article1 = $this->objFromFixture('FormScaffolderTest_Article', 'article1');
$fields = $article1->getCMSFields();
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom($article1);
$this->assertNotNull($fields->dataFieldByName('AuthorID'), 'getCMSFields() includes has_one fields on instances');
@@ -45,7 +45,7 @@ class FormScaffolderTest extends SapphireTest {
$article1 = $this->objFromFixture('FormScaffolderTest_Article', 'article1');
$fields = $article1->getCMSFields();
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom($article1);
$this->assertNotNull(
@@ -60,7 +60,7 @@ class FormScaffolderTest extends SapphireTest {
$fields = $article1->scaffoldFormFields(array(
'restrictFields' => array('Title')
));
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom($article1);
$this->assertNotNull($fields->dataFieldByName('Title'), 'scaffoldCMSFields() includes explitly defined "restrictFields"');
@@ -73,7 +73,7 @@ class FormScaffolderTest extends SapphireTest {
$fields = $article1->scaffoldFormFields(array(
'fieldClasses' => array('Title' => 'HtmlEditorField')
));
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom($article1);
$this->assertNotNull(
@@ -88,7 +88,7 @@ class FormScaffolderTest extends SapphireTest {
function testGetFormFields() {
$fields = singleton('FormScaffolderTest_Article')->getFrontEndFields();
- $form = new Form(new Controller(), 'TestForm', $fields, new FieldSet());
+ $form = new Form(new Controller(), 'TestForm', $fields, new FieldList());
$form->loadDataFrom(singleton('FormScaffolderTest_Article'));
$this->assertFalse($fields->hasTabSet(), 'getFrontEndFields() doesnt produce a TabSet by default');
diff --git a/tests/forms/FormTest.php b/tests/forms/FormTest.php
index aaf522800..06463cc62 100755
--- a/tests/forms/FormTest.php
+++ b/tests/forms/FormTest.php
@@ -16,13 +16,13 @@ class FormTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
new TextField('key1'),
new TextField('namespace[key2]'),
new TextField('namespace[key3][key4]'),
new TextField('othernamespace[key5][key6][key7]')
),
- new FieldSet()
+ new FieldList()
);
// url would be ?key1=val1&namespace[key2]=val2&namespace[key3][key4]=val4&othernamespace[key5][key6][key7]=val7
@@ -56,11 +56,11 @@ class FormTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
new TextField('key1'),
new TextField('key2')
),
- new FieldSet()
+ new FieldList()
);
$form->loadDataFrom(array(
'key1' => 'save',
@@ -81,14 +81,14 @@ class FormTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
new HeaderField('MyPlayerHeader','My Player'),
new TextField('Name'), // appears in both Player and Team
new TextareaField('Biography'),
new DateField('Birthday'),
new NumericField('BirthdayYear') // dynamic property
),
- new FieldSet()
+ new FieldList()
);
$captainWithDetails = $this->objFromFixture('FormTest_Player', 'captainWithDetails');
@@ -122,7 +122,7 @@ class FormTest extends FunctionalTest {
$form = new Form(
new Controller(),
'Form',
- new FieldSet(
+ new FieldList(
new HeaderField('MyPlayerHeader','My Player'),
new TextField('Name'), // appears in both Player and Team
new TextareaField('Biography'),
@@ -131,7 +131,7 @@ class FormTest extends FunctionalTest {
$unrelatedField = new TextField('UnrelatedFormField')
//new CheckboxSetField('Teams') // relation editing
),
- new FieldSet()
+ new FieldList()
);
$unrelatedField->setValue("random value");
@@ -329,8 +329,8 @@ class FormTest extends FunctionalTest {
return new Form(
new Controller(),
'Form',
- new FieldSet(new TextField('key1')),
- new FieldSet()
+ new FieldList(new TextField('key1')),
+ new FieldList()
);
}
@@ -383,12 +383,12 @@ class FormTest_Controller extends Controller implements TestOnly {
$form = new Form(
$this,
'Form',
- new FieldSet(
+ new FieldList(
new EmailField('Email'),
new TextField('SomeRequiredField'),
new CheckboxSetField('Boxes', null, array('1'=>'one','2'=>'two'))
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit')
),
new RequiredFields(
@@ -407,10 +407,10 @@ class FormTest_Controller extends Controller implements TestOnly {
$form = new Form(
$this,
'FormWithSecurityToken',
- new FieldSet(
+ new FieldList(
new EmailField('Email')
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit')
)
);
@@ -444,10 +444,10 @@ class FormTest_ControllerWithSecurityToken extends Controller implements TestOnl
$form = new Form(
$this,
'Form',
- new FieldSet(
+ new FieldList(
new EmailField('Email')
),
- new FieldSet(
+ new FieldList(
new FormAction('doSubmit')
)
);
diff --git a/tests/forms/MemberDatetimeOptionsetFieldTest.php b/tests/forms/MemberDatetimeOptionsetFieldTest.php
index 25f339b61..98616a165 100644
--- a/tests/forms/MemberDatetimeOptionsetFieldTest.php
+++ b/tests/forms/MemberDatetimeOptionsetFieldTest.php
@@ -45,7 +45,7 @@ class MemberDatetimeOptionsetFieldTest extends SapphireTest {
function testDateFormatDefaultCheckedInFormField() {
$field = $this->createDateFormatFieldForMember($this->objFromFixture('Member', 'noformatmember'));
- $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldSet(), new FieldSet())); // fake form
+ $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldList(), new FieldList())); // fake form
$parser = new CSSContentParser($field->Field());
$xmlArr = $parser->getBySelector('#Form_Form_DateFormat_MM_dd_yyyy');
$this->assertEquals('checked', (string) $xmlArr[0]['checked']);
@@ -53,7 +53,7 @@ class MemberDatetimeOptionsetFieldTest extends SapphireTest {
function testTimeFormatDefaultCheckedInFormField() {
$field = $this->createTimeFormatFieldForMember($this->objFromFixture('Member', 'noformatmember'));
- $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldSet(), new FieldSet())); // fake form
+ $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldList(), new FieldList())); // fake form
$parser = new CSSContentParser($field->Field());
$xmlArr = $parser->getBySelector('#Form_Form_TimeFormat_hh_mm_a');
$this->assertEquals('checked', (string) $xmlArr[0]['checked']);
@@ -63,7 +63,7 @@ class MemberDatetimeOptionsetFieldTest extends SapphireTest {
$member = $this->objFromFixture('Member', 'noformatmember');
$member->setField('DateFormat', 'MM/dd/yyyy');
$field = $this->createDateFormatFieldForMember($member);
- $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldSet(), new FieldSet())); // fake form
+ $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldList(), new FieldList())); // fake form
$parser = new CSSContentParser($field->Field());
$xmlArr = $parser->getBySelector('#Form_Form_DateFormat_MM_dd_yyyy');
$this->assertEquals('checked', (string) $xmlArr[0]['checked']);
@@ -73,7 +73,7 @@ class MemberDatetimeOptionsetFieldTest extends SapphireTest {
$member = $this->objFromFixture('Member', 'noformatmember');
$member->setField('DateFormat', 'dd MM yy');
$field = $this->createDateFormatFieldForMember($member);
- $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldSet(), new FieldSet())); // fake form
+ $field->setForm(new Form(new MemberDatetimeOptionsetFieldTest_Controller(), 'Form', new FieldList(), new FieldList())); // fake form
$parser = new CSSContentParser($field->Field());
$xmlInputArr = $parser->getBySelector('.valCustom input');
$xmlPreview = $parser->getBySelector('.preview');
diff --git a/tests/forms/TableFieldTest.php b/tests/forms/TableFieldTest.php
index e18391f5d..dc68c44a6 100755
--- a/tests/forms/TableFieldTest.php
+++ b/tests/forms/TableFieldTest.php
@@ -28,8 +28,8 @@ class TableFieldTest extends SapphireTest {
$form = new Form(
new TableFieldTest_Controller(),
"Form",
- new FieldSet($tableField),
- new FieldSet()
+ new FieldList($tableField),
+ new FieldList()
);
// Test Insert
@@ -106,8 +106,8 @@ class TableFieldTest extends SapphireTest {
$form = new Form(
new TableFieldTest_Controller(),
"Form",
- new FieldSet($tableField),
- new FieldSet()
+ new FieldList($tableField),
+ new FieldList()
);
$this->assertEquals(2, $tableField->sourceItems()->Count());
@@ -155,8 +155,8 @@ class TableFieldTest extends SapphireTest {
$form = new Form(
new TableFieldTest_Controller(),
"Form",
- new FieldSet($tableField),
- new FieldSet()
+ new FieldList($tableField),
+ new FieldList()
);
$this->assertContains($perm1->ID, $tableField->sourceItems()->column('ID'));
@@ -185,7 +185,7 @@ class TableFieldTest extends SapphireTest {
);
// Test with auto relation setting
- $form = new Form(new TableFieldTest_Controller(), "Form", new FieldSet($tf), new FieldSet());
+ $form = new Form(new TableFieldTest_Controller(), "Form", new FieldList($tf), new FieldList());
$form->loadDataFrom($o);
$tf->setValue(array(
diff --git a/tests/forms/TableListFieldTest.php b/tests/forms/TableListFieldTest.php
index 8be886f49..dd3129634 100755
--- a/tests/forms/TableListFieldTest.php
+++ b/tests/forms/TableListFieldTest.php
@@ -17,9 +17,9 @@ class TableListFieldTest extends SapphireTest {
"E" => "Col E",
));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$result = $table->FieldHolder();
@@ -45,9 +45,9 @@ class TableListFieldTest extends SapphireTest {
"E" => "Col E",
));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$items = $table->sourceItems();
$this->assertNotNull($items);
@@ -78,9 +78,9 @@ class TableListFieldTest extends SapphireTest {
"E" => "Col E",
));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$table->ShowPagination = true;
$table->PageSize = 2;
@@ -111,9 +111,9 @@ class TableListFieldTest extends SapphireTest {
"E" => "Col E",
));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$table->ShowPagination = true;
$table->PageSize = 2;
@@ -182,9 +182,9 @@ class TableListFieldTest extends SapphireTest {
"B" => "Col B"
));
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$csvResponse = $table->export();
@@ -219,7 +219,7 @@ class TableListFieldTest extends SapphireTest {
function testLink() {
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
new TableListField("Tester", "TableListFieldTest_Obj", array(
"A" => "Col A",
"B" => "Col B",
@@ -227,7 +227,7 @@ class TableListFieldTest extends SapphireTest {
"D" => "Col D",
"E" => "Col E",
))
- ), new FieldSet());
+ ), new FieldList());
$table = $form->dataFieldByName('Tester');
$this->assertEquals(
@@ -252,9 +252,9 @@ class TableListFieldTest extends SapphireTest {
"E" => "Col E",
));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
$table->ShowPagination = true;
$table->PageSize = 2;
@@ -307,7 +307,7 @@ class TableListFieldTest extends SapphireTest {
$list = new ArrayList(array($one, $two, $three));
// A TableListField must be inside a form for its links to be generated
- $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
+ $form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldList(
new TableListField("Tester", $list, array(
"A" => "Col A",
"B" => "Col B",
@@ -315,7 +315,7 @@ class TableListFieldTest extends SapphireTest {
"D" => "Col D",
"E" => "Col E",
))
- ), new FieldSet());
+ ), new FieldList());
$table = $form->dataFieldByName('Tester');
$rendered = $table->FieldHolder();
@@ -367,8 +367,8 @@ class TableListFieldTest_TestController extends Controller {
$table->disableSorting();
// A TableListField must be inside a form for its links to be generated
- return new Form($this, "TestForm", new FieldSet(
+ return new Form($this, "TestForm", new FieldList(
$table
- ), new FieldSet());
+ ), new FieldList());
}
}
\ No newline at end of file
diff --git a/tests/search/SearchContextTest.php b/tests/search/SearchContextTest.php
index 720dc06c9..9a2917c9f 100644
--- a/tests/search/SearchContextTest.php
+++ b/tests/search/SearchContextTest.php
@@ -85,7 +85,7 @@ class SearchContextTest extends SapphireTest {
$context = $company->getDefaultSearchContext();
$fields = $context->getFields();
$this->assertEquals(
- new FieldSet(
+ new FieldList(
new TextField("Name", 'Name'),
new TextareaField("Industry", 'Industry'),
new NumericField("AnnualProfit", 'The Almighty Annual Profit')
diff --git a/tests/security/GroupTest.php b/tests/security/GroupTest.php
index 37d1f395e..b386abdbe 100644
--- a/tests/security/GroupTest.php
+++ b/tests/security/GroupTest.php
@@ -129,7 +129,7 @@ class GroupTest_Member extends Member implements TestOnly {
function getCMSFields() {
$groups = DataObject::get('Group');
$groupsMap = ($groups) ? $groups->map() : false;
- $fields = new FieldSet(
+ $fields = new FieldList(
new HiddenField('ID', 'ID'),
new CheckboxSetField(
'Groups',
@@ -147,7 +147,7 @@ class GroupTest_MemberForm extends Form {
function __construct($controller, $name) {
$fields = singleton('GroupTest_Member')->getCMSFields();
- $actions = new FieldSet(
+ $actions = new FieldList(
new FormAction('doSave','save')
);
diff --git a/tests/security/SecurityTokenTest.php b/tests/security/SecurityTokenTest.php
index f07567cbe..e1c111eff 100644
--- a/tests/security/SecurityTokenTest.php
+++ b/tests/security/SecurityTokenTest.php
@@ -106,7 +106,7 @@ class SecurityTokenTest extends SapphireTest {
}
function testUpdateFieldSet() {
- $fs = new FieldSet();
+ $fs = new FieldList();
$t = new SecurityToken();
$t->updateFieldSet($fs);
$f = $fs->dataFieldByName($t->getName());
@@ -117,7 +117,7 @@ class SecurityTokenTest extends SapphireTest {
}
function testUpdateFieldSetDoesntAddTwice() {
- $fs = new FieldSet();
+ $fs = new FieldList();
$t = new SecurityToken();
$t->updateFieldSet($fs); // first
$t->updateFieldSet($fs); // second