Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Deleting a page and its versions

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

Page: 1
Go to End
Author Topic: 1337 Views
  • paul.mcilwaine
    Community Member
    21 Posts

    Deleting a page and its versions Link to this post

    I'm creating a module for the cms which when installed needs to remove old pages (default installed pages) and create its own page.

    In my requireDefaultRecords function I have this code which works to a certain extent.

    $records = DataObject::get( "Page" );
    foreach ( $records as $record )

    It deletes the page and in the admin shows as deleted (strike through) However in the cms itself still shows up as a working page, my understanding at least should be because its been deleted shoudn't show in the CMS but only in the Admin marked as deleted. Although this is an issue its not the my main issue at hand. What I want to do is delete the page(s) from the sitetree completely that delete all history and everything associated with it. I thought getting all the versions of the record would work by but didn't have any affect.

    /* in the loop */
    $versions = $record->allVersions();

    What is needed to happen to completely remove this pages.

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.