mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
ENHANCEMENT: use FieldList constructor to replace FieldSet constructor for SilverStripe 3
ENHANCEMENT: use FormActioin constructor to replace ImageFormAction constructor for SilverStripe 3
This commit is contained in:
parent
2ca8ff1c7d
commit
0a4f22a08f
@ -22,11 +22,11 @@ class FrameworktestRegressSessionAdmin extends Controller {
|
||||
$isRunning = (Session::get('db'));
|
||||
|
||||
if($isRunning) {
|
||||
$actions = new FieldSet(
|
||||
$actions = new FieldList(
|
||||
new FormAction('endsession', 'End Session')
|
||||
);
|
||||
} else {
|
||||
$actions = new FieldSet(
|
||||
$actions = new FieldList(
|
||||
new FormAction('startsession', 'Start Session')
|
||||
);
|
||||
}
|
||||
@ -34,7 +34,7 @@ class FrameworktestRegressSessionAdmin extends Controller {
|
||||
$form = new Form(
|
||||
$this,
|
||||
'Form',
|
||||
new FieldSet(
|
||||
new FieldList(
|
||||
new HeaderField('Header1', ($isRunning) ? 'Session is already running' : 'Start new regress session'),
|
||||
new LiteralField('Lit1',
|
||||
'<p>Use this form to set configuration prior to starting a <a href="http://regress.silverstripe.com">regress.silverstripe.com</a> test session (manual testing).</p>'
|
||||
|
@ -7,13 +7,13 @@ class TestFileUploadPage extends TestPage{
|
||||
class TestFileUploadPage_Controller extends TestPage_Controller{
|
||||
|
||||
function Form(){
|
||||
$fields = new FieldSet(
|
||||
$fields = new FieldList(
|
||||
new EmailField('Email', 'EmailField'),
|
||||
new FileField('AFile','FileField'),
|
||||
new SimpleImageField('AImage','SimpleImageField')
|
||||
);
|
||||
|
||||
$actions = new FieldSet(
|
||||
$actions = new FieldList(
|
||||
new FormAction('addMember', "Add a member with two Files uploaded")
|
||||
);
|
||||
return new Form($this, "Form", $fields, $actions);
|
||||
|
@ -40,10 +40,11 @@ class TestPage_Controller extends Page_Controller {
|
||||
*/
|
||||
function Form() {
|
||||
$fields = $this->getCMSFields();
|
||||
$actions = new FieldSet(
|
||||
$actions = new FieldList(
|
||||
new FormAction("save", "Save"),
|
||||
new ImageFormAction("gohome", "Go home", "frameworktest/images/test-button.png")
|
||||
$gohome = new FormAction("gohome", "Go home")
|
||||
);
|
||||
$gohome->setAttribute('src', 'frameworktest/images/test-button.png');
|
||||
$form = new Form($this, "Form", $fields, $actions);
|
||||
$form->loadDataFrom($this->dataRecord);
|
||||
return $form;
|
||||
@ -60,9 +61,9 @@ class TestPage_Controller extends Page_Controller {
|
||||
}
|
||||
|
||||
function EmailForm() {
|
||||
return new Form($this, "EmailForm", new FieldSet(
|
||||
return new Form($this, "EmailForm", new FieldList(
|
||||
new TextField("Email", "Email address")
|
||||
), new FieldSet(
|
||||
), new FieldList(
|
||||
new FormAction("sendEmail", "Send test email to this address")
|
||||
));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class Page2PersonalDetailsFormStep extends MultiFormStep {
|
||||
public static $next_steps = 'Page2OrganisationDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
@ -54,7 +54,7 @@ class Page2OrganisationDetailsFormStep extends MultiFormStep {
|
||||
public static $is_final_step = true;
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('OrganisationName', 'Organisation Name')
|
||||
);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class Page3StartFormStep extends MultiFormStep {
|
||||
public static $next_steps = 'Page3PersonalDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new LiteralField('Details', '<b>This is important</b><br />
|
||||
<p>You will receiving email once you participate in this survey. <br />
|
||||
Under the new Unsolicited Electronic Messages Act 2007, we must have your consent to send emails relating to this form. <br />
|
||||
@ -61,7 +61,7 @@ class Page3PersonalDetailsFormStep extends MultiFormStep {
|
||||
public static $next_steps = 'Page3OrganisationDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
@ -75,7 +75,7 @@ class Page3OrganisationDetailsFormStep extends MultiFormStep {
|
||||
public static $is_final_step = true;
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('OrganisationName', 'Organisation Name')
|
||||
);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class TestMultiForm extends MultiForm {
|
||||
$savedData = array_merge($savedData, $step->loadData());
|
||||
}
|
||||
|
||||
$fields = new FieldSet();
|
||||
$fields = new FieldList();
|
||||
$fields->push(new LiteralField("Heading", "<h3>You have submitted the following information:</h3>"));
|
||||
|
||||
foreach($savedData as $key=>$value) {
|
||||
@ -29,7 +29,7 @@ class TestMultiFormStepOne extends MultiFormStep {
|
||||
public static $next_steps = 'TestMultiFormStepTwo';
|
||||
|
||||
function getFields() {
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
@ -42,7 +42,7 @@ class TestMultiFormStepTwo extends MultiFormStep {
|
||||
|
||||
function getFields() {
|
||||
|
||||
return new FieldSet(
|
||||
return new FieldList(
|
||||
new TextField('Email', 'Email'),
|
||||
new TextField('Address', 'Address')
|
||||
);
|
||||
@ -62,7 +62,7 @@ class TestMultiFormStepThree extends MultiFormStep {
|
||||
$savedData = array_merge($savedData, $step->loadData());
|
||||
}
|
||||
|
||||
$fields = new FieldSet();
|
||||
$fields = new FieldList();
|
||||
$fields->push(new LiteralField("Heading", "<h3>You have submitted the following information:</h3>"));
|
||||
|
||||
foreach($savedData as $key=>$value) {
|
||||
|
@ -6,7 +6,7 @@ class TestMultiFormPage extends Page {
|
||||
class TestMultiFormPage_Controller extends Page_Controller {
|
||||
|
||||
function Form() {
|
||||
$form = new TestMultiForm($this, 'Form', new FieldSet(), new FieldSet());
|
||||
$form = new TestMultiForm($this, 'Form', new FieldList(), new FieldList());
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ class RecaptchaTestPage extends Page {
|
||||
class RecaptchaTestPage_Controller extends Page_Controller {
|
||||
|
||||
function Form() {
|
||||
$fields = new FieldSet(
|
||||
$fields = new FieldList(
|
||||
new TextField('MyText')
|
||||
);
|
||||
if(class_exists('RecaptchaField')) {
|
||||
@ -19,7 +19,7 @@ class RecaptchaTestPage_Controller extends Page_Controller {
|
||||
$this,
|
||||
'Form',
|
||||
$fields,
|
||||
new FieldSet(
|
||||
new FieldList(
|
||||
new FormAction('submit', 'submit')
|
||||
),
|
||||
new RequiredFields(array('MyText'))
|
||||
|
Loading…
Reference in New Issue
Block a user