diff --git a/code/BasicFieldsTestPage.php b/code/BasicFieldsTestPage.php index 4723dff..36b4f64 100644 --- a/code/BasicFieldsTestPage.php +++ b/code/BasicFieldsTestPage.php @@ -36,11 +36,10 @@ class BasicFieldsTestPage extends TestPage 'GSTNumber' => 'Varchar', 'OptionSet' => 'Int', ); - + private static $has_one = array( 'Dropdown' => 'TestCategory', 'GroupedDropdown' => 'TestCategory', - 'ListboxField' => 'TestCategory', 'File' => 'File', 'AttachedFile' => 'File', 'Image' => 'Image', @@ -100,7 +99,6 @@ class BasicFieldsTestPage extends TestPage 'CheckboxSetID' => $firstCat->ID, 'DropdownID' => $firstCat->ID, 'GroupedDropdownID' => $firstCat->ID, - 'ListboxFieldID' => $firstCat->ID, 'MultipleListboxFieldID' => join(',', array($thirdCat->ID, $firstCat->ID)), 'OptionSet' => join(',', array($thirdCat->ID, $firstCat->ID)), 'Date' => "2002-10-23", @@ -112,13 +110,13 @@ class BasicFieldsTestPage extends TestPage 'DateTimeWithCalendar' => "2002-10-23 23:59", ); } - + public function getCMSFields() { $fields = parent::getCMSFields(); $description = 'This is bold help text'; - + $fields->addFieldsToTab('Root.Text', array( Object::create('TextField', 'Required', 'Required field'), Object::create('TextField', 'Validated', 'Validated field (checks range between 1 and 3)'), @@ -138,7 +136,7 @@ class BasicFieldsTestPage extends TestPage Object::create('PhoneNumberField', 'PhoneNumber', 'PhoneNumberField'), Object::create('CreditCardField', 'CreditCard', 'CreditCardField') )); - + $fields->addFieldsToTab('Root.Option', array( Object::create('CheckboxField', 'Checkbox', 'CheckboxField'), Object::create('CheckboxSetField', 'CheckboxSet', 'CheckboxSetField', TestCategory::map()), @@ -147,10 +145,7 @@ class BasicFieldsTestPage extends TestPage Object::create('GroupedDropdownField', 'GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map()) ), - Object::create('ListboxField', 'ListboxFieldID', 'ListboxField', TestCategory::map()) - ->setSize(3), Object::create('ListboxField', 'MultipleListboxFieldID', 'ListboxField (multiple)', TestCategory::map()) - ->setMultiple(true) ->setSize(3), Object::create('OptionsetField', 'OptionSet', 'OptionSetField', TestCategory::map()), Object::create('ToggleCompositeField', 'ToggleCompositeField', 'ToggleCompositeField', new FieldList( diff --git a/code/TestPage.php b/code/TestPage.php index 56e6914..f1e214c 100644 --- a/code/TestPage.php +++ b/code/TestPage.php @@ -5,11 +5,11 @@ */ class TestPage extends Page { - + /** * We can only create subclasses of TestPage */ - public function canCreate($member = null) + public function canCreate($member = null, $context = array()) { // Don't allow creation other than through requireDefaultRecords return false; @@ -27,7 +27,7 @@ class TestPage extends Page $parent = SiteTree::get() ->filter('URLSegment', 'feature-test-pages') ->First(); - + if (!$parent) { $parent = new Page(array( 'Title' => 'Feature Test Pages', @@ -60,7 +60,7 @@ class TestPage_Controller extends Page_Controller 'Form', 'save', ); - + /** * This form is exactly like the CMS form. It gives us an opportunity to test the fields outside of the CMS context */ @@ -76,14 +76,14 @@ class TestPage_Controller extends Page_Controller $form->loadDataFrom($this->dataRecord); return $form; } - + public function save($data, $form) { $form->saveInto($this->dataRecord); $this->dataRecord->write(); $this->redirectBack(); } - + public function gohome() { $this->redirect("./"); @@ -97,7 +97,7 @@ class TestPage_Controller extends Page_Controller new FormAction("sendEmail", "Send test email to this address") )); } - + public function email() { return array( @@ -105,7 +105,7 @@ class TestPage_Controller extends Page_Controller 'Form' => $this->EmailForm() ); } - + public function sendEmail($data, $form) { $email = new Email(); @@ -114,7 +114,7 @@ class TestPage_Controller extends Page_Controller $email->setSubject('A subject with some umlauts: öäüß'); $email->setBody('A body with some umlauts: öäüß'); $email->send(); - + echo "

email sent to " . $data['Email'] . "

"; } } diff --git a/composer.json b/composer.json index e606d24..659a01e 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { - "silverstripe/framework": "~3.1", - "silverstripe/cms": "~3.1" + "silverstripe/framework": "~4.0", + "silverstripe/cms": "~4.0" } }