silverstripe-framework/docs/en/reference/versioned.md
Will Rossiter 62ed1386a3 MINOR: documentation fixes from comments provided by the community. See below for a list of fixes:
* fixed typo in Email documentation.
* updated link for tutorial code to be relative now that bug #6408 is fixed
* removed 2.3 related docs from 2.4 docs folder
* fixed typo with Orientation documentation
* updated old task url for images/flush
2011-08-11 13:55:27 +12:00

520 B

Versioned

The Versioned class is a [api:DataObject] that adds versioning and staging capabilities to the objects.

Trapping the publication event

Sometimes, you'll want to do something whenever a particular kind of page is published. This example sends an email whenever a blog entry has been published.

:::php
class Page extends SiteTree {
  // ...
  function onAfterPublish() {
    mail("sam@silverstripe.com", "Blog published", "The blog has been published");
    parent::onAfterPublish();
  }
}