Use PageController without underscore

This commit is contained in:
Ingo Schommer 2017-01-15 21:19:56 +13:00
parent 550f9856d6
commit db7c537666
8 changed files with 31 additions and 38 deletions

View File

@ -23,7 +23,7 @@ class GridFieldTestPage extends TestPage
private static $many_many = array( private static $many_many = array(
"ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company", "ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company",
); );
public function getCMSFields() public function getCMSFields()
{ {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
@ -55,33 +55,33 @@ class GridFieldTestPage extends TestPage
} }
} }
class GridFieldTestPage_Controller extends Page_Controller class GridFieldTestPage_Controller extends PageController
{ {
private static $allowed_actions = array( private static $allowed_actions = array(
'Form', 'Form',
); );
/** /**
* *
* @var string * @var string
*/ */
public $Title = "GridFieldTestPage"; public $Title = "GridFieldTestPage";
public function init() public function init()
{ {
parent::init(); parent::init();
Requirements::css('frameworktest/css/gridfieldtest.css', 'screen'); Requirements::css('frameworktest/css/gridfieldtest.css', 'screen');
} }
/** /**
* *
* @return Form * @return Form
*/ */
public function Form() public function Form()
{ {
$config = new GridFieldConfig_RecordEditor(); $config = new GridFieldConfig_RecordEditor();
$grid = new GridField('Companies', 'Companies', new DataList('SilverStripe\\FrameworkTest\\Model\\Company'), $config); $grid = new GridField('Companies', 'Companies', new DataList('SilverStripe\\FrameworkTest\\Model\\Company'), $config);
return new Form($this, 'Form', new FieldList($grid), new FieldList()); return new Form($this, 'Form', new FieldList($grid), new FieldList());
} }

View File

@ -3,14 +3,7 @@
namespace SilverStripe\FrameworkTest\Model; namespace SilverStripe\FrameworkTest\Model;
use Page; use Page;
use PageController;
use Page_Controller;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FormAction;
@ -77,7 +70,7 @@ class TestPage extends Page
/** /**
* Parent class of all test page controllers * Parent class of all test page controllers
*/ */
class TestPage_Controller extends Page_Controller class TestPage_Controller extends PageController
{ {
private static $allowed_actions = array( private static $allowed_actions = array(
'Form', 'Form',

View File

@ -4,9 +4,9 @@ class Page2MultiFormTestPage extends Page
{ {
} }
class Page2MultiFormTestPage_Controller extends Page_Controller class Page2MultiFormTestPage_Controller extends PageController
{ {
public function Page2MultiForm() public function Page2MultiForm()
{ {
return new Page2MultiForm($this, 'Page2MultiForm'); return new Page2MultiForm($this, 'Page2MultiForm');

View File

@ -4,9 +4,9 @@ class Page3MultiFormTestPage extends Page
{ {
} }
class Page3MultiFormTestPage_Controller extends Page_Controller class Page3MultiFormTestPage_Controller extends PageController
{ {
public function Page3MultiForm() public function Page3MultiForm()
{ {
return new Page3MultiForm($this, 'Page3MultiForm'); return new Page3MultiForm($this, 'Page3MultiForm');

View File

@ -3,25 +3,25 @@ class TestMultiFormPage extends Page
{ {
} }
class TestMultiFormPage_Controller extends Page_Controller class TestMultiFormPage_Controller extends PageController
{ {
public function Form() public function Form()
{ {
$form = new TestMultiForm($this, 'Form', new FieldList(), new FieldList()); $form = new TestMultiForm($this, 'Form', new FieldList(), new FieldList());
return $form; return $form;
} }
public function FormMessage() public function FormMessage()
{ {
if (Session::get('MultiFormMessage')) { if (Session::get('MultiFormMessage')) {
$message = Session::get('MultiFormMessage'); $message = Session::get('MultiFormMessage');
Session::clear('MultiFormMessage'); Session::clear('MultiFormMessage');
return $message; return $message;
} }
return false; return false;
} }
} }

View File

@ -11,9 +11,9 @@ class RecaptchaTestPage extends Page
{ {
} }
class RecaptchaTestPage_Controller extends Page_Controller class RecaptchaTestPage_Controller extends PageController
{ {
public function Form() public function Form()
{ {
$fields = new FieldList( $fields = new FieldList(
@ -24,7 +24,7 @@ class RecaptchaTestPage_Controller extends Page_Controller
} else { } else {
$fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>')); $fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>'));
} }
$form = new Form( $form = new Form(
$this, $this,
'Form', 'Form',
@ -34,14 +34,14 @@ class RecaptchaTestPage_Controller extends Page_Controller
), ),
new RequiredFields(array('MyText')) new RequiredFields(array('MyText'))
); );
return $form; return $form;
} }
public function submit($data, $form) public function submit($data, $form)
{ {
$form->sessionMessage('Hooray!', 'good'); $form->sessionMessage('Hooray!', 'good');
return Director::redirectBack(); return Director::redirectBack();
} }
} }

View File

@ -1,25 +1,25 @@
<?php <?php
use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\LiteralField;
class SifrPage extends Page class SifrPage extends Page
{ {
public function getCMSFields() public function getCMSFields()
{ {
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.SifrSampleImage", new LiteralField("SifrSampleImage", '<p><img src="frameworktest/images/sifr_sample.png"/></p>')); $fields->addFieldToTab("Root.Content.SifrSampleImage", new LiteralField("SifrSampleImage", '<p><img src="frameworktest/images/sifr_sample.png"/></p>'));
return $fields; return $fields;
} }
} }
class SifrPage_Controller extends Page_Controller class SifrPage_Controller extends PageController
{ {
public function init() public function init()
{ {
parent::init(); parent::init();
Sifr::add_font('blackout', 'themes/fonts/blackout.swf'); Sifr::add_font('blackout', 'themes/fonts/blackout.swf');
Sifr::replace_element('blackout', 'h2', "'.sIFR-root { text-align: left; color: red;'"); Sifr::replace_element('blackout', 'h2', "'.sIFR-root { text-align: left; color: red;'");
Sifr::replace_element('blackout', 'h3', "'.sIFR-root { text-align: left; color: red;'"); Sifr::replace_element('blackout', 'h3', "'.sIFR-root { text-align: left; color: red;'");

View File

@ -37,4 +37,4 @@
// } // }
// class TestTagFieldPage_Controller extends Page_Controller {} // class TestTagFieldPage_Controller extends PageController {}