SiteTreeSubsites
class SiteTreeSubsites extends Extension (View source)
Extension for the SiteTree object to add subsites support
Properties
protected | T | $owner | The object this extension is applied to. |
from Extension |
Methods
Called when this extension is added to a particular class
Temporarily modify the owner. The original owner is ensured to be restored
Clear the current owner, and restore extension to the state prior to the last setOwner()
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
Invoke extension point. This will prefer explicit extend
prefixed
methods.
Update any requests to limit the results to the current site
Does the basic duplication, but doesn't write anything this means we can subclass this easier and do more complex relation duplication.
Create a duplicate of this page and save it to another subsite
Duplicate relations using a static property to define which ones we want to duplicate
Use the CMS domain for iframed CMS previews to prevent single-origin violations and SSL cert problems. Always set SubsiteID to avoid errors because a page doesn't exist on the CMS domain.
Inject the subsite ID into the content so it can be used by frontend scripts.
Ensure that valid url segments are checked within the correct subsite of the owner object, even if the current subsiteID is set to some other subsite.
Return a piece of text to keep DataObject cache keys appropriately specific
Details
__construct()
No description
static
add_to_class(string $class, string $extensionClass, mixed $args = null)
Called when this extension is added to a particular class
setOwner(object $owner)
Set the owner of this extension.
mixed
withOwner(mixed $owner, callable $callback, array $args = [])
Temporarily modify the owner. The original owner is ensured to be restored
clearOwner()
Clear the current owner, and restore extension to the state prior to the last setOwner()
T
getOwner()
Returns the owner of this extension.
static string
get_classname_without_arguments(string $extensionStr)
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
mixed
invokeExtension(object $owner, string $method, array ...$arguments)
Invoke extension point. This will prefer explicit extend
prefixed
methods.
isMainSite()
No description
protected
augmentSQL(SQLSelect $query, DataQuery|null $dataQuery = null)
Update any requests to limit the results to the current site
protected
onBeforeWrite()
No description
protected
updateCMSFields(FieldList $fields)
No description
SiteTree
duplicateToSubsitePrep(Subsite|int $subsiteID, bool $includeChildren)
Does the basic duplication, but doesn't write anything this means we can subclass this easier and do more complex relation duplication.
Note that when duplicating including children, everything is written.
protected
onBeforeDuplicate()
When duplicating a page, assign the current subsite ID from the state
SiteTree
duplicateToSubsite(Subsite|int $subsiteID = null, bool $includeChildren = false)
Create a duplicate of this page and save it to another subsite
duplicateSubsiteRelations(SiteTree $originalPage)
Duplicate relations using a static property to define which ones we want to duplicate
It may be that some relations are not diostinct to sub site so can stay whereas others may need to be duplicated
This was originally deprecated - Use the "cascade_duplicates" config API instead Ideally this would be re-deprecated
protected SiteConfig
alternateSiteConfig()
No description
protected bool|null
canEdit(Member|null $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"
If there are no subsites configured yet, this logic is skipped.
protected bool
canDelete(null $member = null)
No description
protected bool
canAddChildren(null $member = null)
No description
protected bool|null
canPublish(Member|null $member = null)
No description
static
contentcontrollerInit($controller)
Called by ContentController::init();
string
alternateAbsoluteLink(null $action = null)
No description
protected string
updatePreviewLink(string $link, string|null $action = null)
Use the CMS domain for iframed CMS previews to prevent single-origin violations and SSL cert problems. Always set SubsiteID to avoid errors because a page doesn't exist on the CMS domain.
protected string
updateMetaTags($tags)
deprecated
deprecated 3.4.0 Will be renamed to updateMetaTags()
Inject the subsite ID into the content so it can be used by frontend scripts.
protected
augmentSyncLinkTracking()
No description
protected null|bool
augmentValidURLSegment()
Ensure that valid url segments are checked within the correct subsite of the owner object, even if the current subsiteID is set to some other subsite.
protected
cacheKeyComponent()
Return a piece of text to keep DataObject cache keys appropriately specific
protected bool|null
canCreate(Member $member = null)
No description
void
ManyManyList() $SiteTree> CrossSubsiteLinkTracking()
No description
Subsite
Subsite()
No description