2011-04-15 11:37:15 +02:00
|
|
|
<?php
|
2013-05-10 02:22:22 +02:00
|
|
|
|
2016-06-16 06:57:19 +02:00
|
|
|
use SilverStripe\ORM\DataExtension;
|
|
|
|
|
2011-04-15 11:37:15 +02:00
|
|
|
/**
|
|
|
|
* Plug-ins for additional functionality in your SiteTree classes.
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2011-04-15 11:37:15 +02:00
|
|
|
* @package cms
|
|
|
|
* @subpackage model
|
|
|
|
*/
|
|
|
|
abstract class SiteTreeExtension extends DataExtension {
|
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
2016-04-01 05:17:37 +02:00
|
|
|
* Hook called before the page's {@link Versioned::publishSingle()} action is completed
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @param SiteTree &$original The current Live SiteTree record prior to publish
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function onBeforePublish(&$original) {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
2016-04-01 05:17:37 +02:00
|
|
|
* Hook called after the page's {@link Versioned::publishSingle()} action is completed
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @param SiteTree &$original The current Live SiteTree record prior to publish
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function onAfterPublish(&$original) {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
2016-03-08 21:50:55 +01:00
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
2016-04-01 05:17:37 +02:00
|
|
|
* Hook called before the page's {@link Versioned::doUnpublish()} action is completed
|
2013-05-10 02:22:22 +02:00
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function onBeforeUnpublish() {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
2016-03-08 21:50:55 +01:00
|
|
|
|
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* Hook called after the page's {@link SiteTree::doUnpublish()} action is completed
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function onAfterUnpublish() {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
2016-03-08 21:50:55 +01:00
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* Hook called to determine if a user may add children to this SiteTree object
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @see SiteTree::canAddChildren()
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @param Member $member The member to check permission against, or the currently
|
|
|
|
* logged in user
|
|
|
|
* @return boolean|null Return false to deny rights, or null to yield to default
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function canAddChildren($member) {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
2016-03-08 21:50:55 +01:00
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* Hook called to determine if a user may publish this SiteTree object
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @see SiteTree::canPublish()
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @param Member $member The member to check permission against, or the currently
|
|
|
|
* logged in user
|
|
|
|
* @return boolean|null Return false to deny rights, or null to yield to default
|
|
|
|
*/
|
2012-09-19 12:07:46 +02:00
|
|
|
public function canPublish($member) {
|
2013-05-10 02:22:22 +02:00
|
|
|
}
|
2016-03-08 21:50:55 +01:00
|
|
|
|
2013-05-10 02:22:22 +02:00
|
|
|
/**
|
|
|
|
* Hook called to modify the $base url of this page, with a given $action,
|
|
|
|
* before {@link SiteTree::RelativeLink()} calls {@link Controller::join_links()}
|
|
|
|
* on the $base and $action
|
2016-01-06 00:42:07 +01:00
|
|
|
*
|
2013-05-10 02:22:22 +02:00
|
|
|
* @param string &$base The URL of this page relative to siteroot, not including
|
|
|
|
* the action
|
|
|
|
* @param string|boolean &$action The action or subpage called on this page.
|
|
|
|
* (Legacy support) If this is true, then do not reduce the 'home' urlsegment
|
|
|
|
* to an empty link
|
|
|
|
*/
|
|
|
|
public function updateRelativeLink(&$base, &$action) {
|
2011-04-15 11:37:15 +02:00
|
|
|
}
|
|
|
|
|
2012-04-12 09:23:20 +02:00
|
|
|
}
|