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(
"ManyManyCompanies" => "SilverStripe\\FrameworkTest\\Model\\Company",
);
public function 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(
'Form',
);
/**
*
* @var string
*/
public $Title = "GridFieldTestPage";
public function init()
{
parent::init();
Requirements::css('frameworktest/css/gridfieldtest.css', 'screen');
}
/**
*
* @return Form
* @return Form
*/
public function Form()
{
$config = new GridFieldConfig_RecordEditor();
$grid = new GridField('Companies', 'Companies', new DataList('SilverStripe\\FrameworkTest\\Model\\Company'), $config);
return new Form($this, 'Form', new FieldList($grid), new FieldList());
}

View File

@ -3,14 +3,7 @@
namespace SilverStripe\FrameworkTest\Model;
use Page;
use Page_Controller;
use PageController;
use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\FormAction;
@ -77,7 +70,7 @@ class TestPage extends Page
/**
* Parent class of all test page controllers
*/
class TestPage_Controller extends Page_Controller
class TestPage_Controller extends PageController
{
private static $allowed_actions = array(
'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()
{
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()
{
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()
{
$form = new TestMultiForm($this, 'Form', new FieldList(), new FieldList());
return $form;
}
public function FormMessage()
{
if (Session::get('MultiFormMessage')) {
$message = Session::get('MultiFormMessage');
Session::clear('MultiFormMessage');
return $message;
}
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()
{
$fields = new FieldList(
@ -24,7 +24,7 @@ class RecaptchaTestPage_Controller extends Page_Controller
} else {
$fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>'));
}
$form = new Form(
$this,
'Form',
@ -34,14 +34,14 @@ class RecaptchaTestPage_Controller extends Page_Controller
),
new RequiredFields(array('MyText'))
);
return $form;
}
public function submit($data, $form)
{
$form->sessionMessage('Hooray!', 'good');
return Director::redirectBack();
}
}

View File

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