Created
October 9, 2014 11:56
-
-
Save blpraveen/8c64f04f97cd43cbad3c to your computer and use it in GitHub Desktop.
A simple extension for SilverStripe 3.1 that restores the status tag behavior of sapphire framework 2.4. Needs SiteTree::add_extension('PageStatusExtension'); in your config.
This file contains hidden or 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
class PageStatusExtension extends DataExtension { | |
private static $db = array( | |
'Status' => 'Varchar' | |
); | |
private static $defaults = array( | |
"Status" => "New page", | |
} | |
public onBeforePublish($original) { | |
$original->Status = "Published"; | |
} | |
public onBeforeUnpublish($original) { | |
$original->Status = "Unpublished"; | |
} | |
public onBeforeRevertToLive($original) { | |
$original->Status = "Published"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment