mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: Make it easier to create pageless subclasses of Page_Controller
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67242 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bc9d54a47e
commit
e802eaa1d9
@ -25,7 +25,14 @@ class ContentController extends Controller {
|
||||
* The ContentController will take the URLSegment parameter from the URL and use that to look
|
||||
* up a SiteTree record.
|
||||
*/
|
||||
public function __construct($dataRecord) {
|
||||
public function __construct($dataRecord = null) {
|
||||
if(!$dataRecord) {
|
||||
$dataRecord = new Page();
|
||||
if($this->hasMethod("Title")) $dataRecord->Title = $this->Title();
|
||||
$dataRecord->URLSegment = get_class($this);
|
||||
$dataRecord->ID = -1;
|
||||
}
|
||||
|
||||
$this->dataRecord = $dataRecord;
|
||||
$this->failover = $this->dataRecord;
|
||||
parent::__construct();
|
||||
|
Loading…
x
Reference in New Issue
Block a user