Version: current

# Class SiteTreeSubsites

Extension for the SiteTree object to add subsites support

  Extension
  DataObjectDecorator
  SiteTreeDecorator
  SiteTreeSubsites

Located at subsites/code/SiteTreeSubsites.php

## Methods summary

`public static` | # `set_template_fields( mixed $fieldList )` Set the fields that will be copied from the template. Note that ParentID and Sort are implied. Set the fields that will be copied from the template. Note that ParentID and Sort are implied.
`public static` | # `get_homepage_urlsegment_by_subsite( mixed $SubsiteID )`
`public array` | # `extraStatics( )` Define extra database fields Define extra database fields Return a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined. #### Returns `array` Returns a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined. #### Overrides `DataObjectDecorator::extraStatics`
`public` | # `isMainSite( )`
`public` | # `augmentSQL( `SQLQuery` & $query )` Update any requests to limit the results to the current site Update any requests to limit the results to the current site #### Parameters $query SQLQuery $query Query to augment. #### Overrides `DataObjectDecorator::augmentSQL`
`public` | # `nextWriteDoesntCustomise( )` Call this method before writing; the next write carried out by the system won't set the CustomContent value Call this method before writing; the next write carried out by the system won't set the CustomContent value
`public` | # `onBeforeWrite( )` #### Overrides `DataObjectDecorator::onBeforeWrite`
`public` | # `onAfterWrite( mixed & $original )` #### Overrides `DataObjectDecorator::onAfterWrite`
`public` | # `onAfterPublish( mixed & $original )` #### Overrides `SiteTreeDecorator::onAfterPublish`
`public` | # `updateCMSFields( `FieldSet` & $fields )` This function is used to provide modifications to the form in the CMS by the decorator. By default, no changes are made. DataObject->getCMSFields(). This function is used to provide modifications to the form in the CMS by the decorator. By default, no changes are made. DataObject->getCMSFields(). Please consider using updateFormFields() to globally add formfields to the record. The method `SiteTreeSubsites::updateCMSFields()` should just be used to add or modify tabs, or fields which are specific to the CMS-context. Caution: Use FieldSet->addFieldToTab() to add fields. #### Parameters $fields FieldSet $fields FieldSet with a contained TabSet #### Overrides `DataObjectDecorator::updateCMSFields`
`public` | # `ReverseRelated( )` Returns the RelatedPageLink objects that are reverse-associated with this page. Returns the RelatedPageLink objects that are reverse-associated with this page.
`public` | # `NormalRelated( )`
`public` | # `alternateSiteConfig( )`
`public boolean` | # `canEdit( mixed $member = null )` Only allow editing of a page if the member satisfies one of the following conditions: Is in a group which has access to the subsite this page belongs to Is in a group with edit permissions on the "main site" Only allow editing of a page if the member satisfies one of the following conditions: Is in a group which has access to the subsite this page belongs to Is in a group with edit permissions on the "main site" #### Returns `boolean` boolean #### Overrides `DataObjectDecorator::canEdit`
`public boolean` | # `canDelete( mixed $member = null )` #### Returns `boolean` boolean #### Overrides `DataObjectDecorator::canDelete`
`public boolean` | # `canAddChildren( mixed $member = null )` #### Returns `boolean` boolean #### Overrides `SiteTreeDecorator::canAddChildren`
`public boolean` | # `canPublish( mixed $member = null )` #### Returns `boolean` boolean #### Overrides `SiteTreeDecorator::canPublish`
`public` | # `duplicateToSubsite( mixed $subsiteID = null, mixed $isTemplate = true )` Create a duplicate of this page and save it to another subsite Create a duplicate of this page and save it to another subsite #### Parameters $subsiteID $subsiteID int|Subsite The Subsite to copy to, or its ID $isTemplate $isTemplate boolean If this is true, then the current page will be treated as the template, and MasterPageID will be set
`public static` | # `contentcontrollerInit( mixed $controller )` Called by ContentController::init(); Called by ContentController::init();
`public static` | # `modelascontrollerInit( mixed $controller )` Called by ModelAsController::init(); Called by ModelAsController::init();
`public` | # `alternateAbsoluteLink( )`
`public` | # `augmentSyncLinkTracking( )`
`public` | # `cacheKeyComponent( )` Return a piece of text to keep DataObject cache keys appropriately specific Return a piece of text to keep DataObject cache keys appropriately specific

### Methods inherited from SiteTreeDecorator

`onAfterUnpublish()`, `onBeforePublish()`, `onBeforeUnpublish()`

### Methods inherited from DataObjectDecorator

`augmentDatabase()`, `augmentWrite()`, `can()`, `canCreate()`, `flushCache()`, `load_extra_statics()`, `onAfterDelete()`, `onBeforeDelete()`, `populateDefaults()`, `requireDefaultRecords()`, `updateCMSActions()`, `updateFieldLabels()`, `updateFrontEndFields()`, `updateSummaryFields()`

### Methods inherited from Extension

`__construct()`, `clearOwner()`, `getOwner()`, `get_classname_without_arguments()`, `setOwner()`

### Magic methods summary

## Properties summary

`public static array` | $template_variables | #
`public static array` | $template_fields | #
`protected boolean` | $nextWriteDoesntCustomise | #

### Properties inherited from DataObjectDecorator

`$decoratable_statics`

### Properties inherited from Extension

`$allowed_actions`, `$class`, `$owner`, `$ownerBaseClass`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -