Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Overloading requireDefaultRecords for Home

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 430 Views
  • zenmonkey
    Community Member
    528 Posts

    Overloading requireDefaultRecords for Home Link to this post

    Is there anyway to change the PageType for Home in the requireDefaultRecords() to differnt page type other than Page without editing the core file?

  • Willr
    Forum Moderator
    5497 Posts

    Re: Overloading requireDefaultRecords for Home Link to this post

    Sure, requireDefaultRecords is run once per class so on your Page.php

    function requireDefaultRecords() {

    $home = DataObject::get_one("Page", "URLSegment = 'home'");
    $home->ClassName = "NewSomethingClass";
    $home->publish('Stage', 'Live');

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.