Created
November 22, 2014 07:44
-
-
Save dljoseph/263f78375652cb079c5c to your computer and use it in GitHub Desktop.
SilverStripe Auto-create page type on dev/build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create default Info Page setup | |
*/ | |
function requireDefaultRecords() { | |
parent::requireDefaultRecords(); | |
// Skip creation of default records | |
if(!self::config()->create_default_pages) return; | |
$infoPage = InfoPage::get()->first(); | |
if(!$infoPage) { | |
$infoPage = new InfoPage(); | |
$infoPage->Title = "Our Story"; | |
$infoPage->URLSegment = 'about'; | |
$infoPage->Content = ""; | |
$infoPage->Status = "Published"; | |
$infoPage->ParentID = 0; | |
$infoPage->write(); | |
$infoPage->publish("Stage", "Live"); | |
DB::alteration_message("Info Page created","created"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment