21301 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 141 Views |
-
Overloading requireDefaultRecords for Home

20 December 2012 at 5:53am
Is there anyway to change the PageType for Home in the requireDefaultRecords() to differnt page type other than Page without editing the core file?
-
Re: Overloading requireDefaultRecords for Home

20 December 2012 at 8:10pm
Sure, requireDefaultRecords is run once per class so on your Page.php
function requireDefaultRecords() {
parent::requireDefaultRecords();$home = DataObject::get_one("Page", "URLSegment = 'home'");
$home->ClassName = "NewSomethingClass";
$home->write();
$home->publish('Stage', 'Live');
}
| 141 Views | ||
|
Page:
1
|
Go to Top |


