Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • BaseObjectCategory
  • BookingAdminPage
  • BookingPage
  • ErrorPage
  • ErrorPage_Controller
  • MediawebPage
  • Notifications
  • Page
  • Room
  • RoomCatalog
  • SiteConfig
  • SiteTree
  • SubsitesSelectorPage
  • SubsitesVirtualPage
  • SubsitesVirtualPage_Controller
  • VideoBankPage
  • VirtualPage
  • VirtualPage_Controller
  • VirtualProduct_Controller

Interfaces

  • HiddenClass

Class SiteTree

Basic data-object representing all pages within the site tree. This data-object takes care of the heirachy. All page types that live within the heirachy should inherit from this.

In addition, it contains a number of static methods for querying the site tree.

Object
Extended by ViewableData implements IteratorAggregate
Extended by DataObject implements DataObjectInterface, i18nEntityProvider
Extended by SiteTree implements PermissionProvider, i18nEntityProvider

Direct known subclasses

Page

Indirect known subclasses

Announcement, AnnouncementHolder, DocumentsPage, ErrorPage, Event, EventHolder, FaqHolder, FaqSection, Guestbook, HomePage, MapObject, MapObjectGroup, BaseObjectCategory, MapPage, MediawebPage, NewsEntry, NewsHolder, PhotoAlbumPage, PhotoGalleryPage, Product, ProductSearchPage, ProfilePage, PublHolder, BookingAdminPage, Publication, RedirectorPage, RegistrationPage, Room, RoomCatalog, SimpleOrderPage, SpecialCatalog, StartCatalog, SubscribeForm, SubsitesSelectorPage, BookingPage, SubsitesVirtualPage, UserDefinedForm, VideoBankPage, VirtualPage, VirtualProduct, CartPage, Catalog, CheckoutPage, ContactsPage, DocPage

Package: cms
Located at sapphire/core/model/SiteTree.php

Methods summary

public static
# set_enforce_strict_hierarchy( mixed $to )
public static
# get_enforce_strict_hierarchy( )
public static boolean
# nested_urls( )

Returns TRUE if nested URLs (e.g. page/sub-page/) are currently enabled on this site.

Returns TRUE if nested URLs (e.g. page/sub-page/) are currently enabled on this site.

Returns

boolean
bool
public static
# enable_nested_urls( )
public static
# disable_nested_urls( )
public static SiteTree
# get_by_link( string $link, boolean $cache = true )

Fetches the SiteTree object that maps to a link.

Fetches the SiteTree object that maps to a link.

If you have enabled SiteTree::nested_urls() on this site, then you can use a nested link such as "about-us/staff/", and this function will traverse down the URL chain and grab the appropriate link.

Note that if no model can be found, this method will fall over to a decorated alternateGetByLink method provided by a decorator attached to SiteTree

Parameters

$link
string $link
$cache
bool $cache

Returns

SiteTree
SiteTree
public static array
# page_type_classes( )

Return a subclass map of SiteTree that shouldn't be hidden through SiteTree::$hide_ancestor

Return a subclass map of SiteTree that shouldn't be hidden through SiteTree::$hide_ancestor

Returns

array
array
public static string
# link_shortcode_handler( mixed $arguments, mixed $content = null, mixed $parser = null )

Replace a "[sitetree_link id=n]" shortcode with a link to the page with the corresponding ID.

Replace a "[sitetree_link id=n]" shortcode with a link to the page with the corresponding ID.

Returns

string
string
public string
# Link( string $action = null )

Return the link for this SiteTree object, with the Director::baseURL() included.

Return the link for this SiteTree object, with the Director::baseURL() included.

Parameters

$action
string $action

Returns

string
string
public string
# AbsoluteLink( string $action = null )

Get the absolute URL for this page, including protocol and host.

Get the absolute URL for this page, including protocol and host.

Parameters

$action
string $action

Returns

string
string
public string
# RelativeLink( string $action = null )

Return the link for this SiteTree object relative to the SilverStripe root.

Return the link for this SiteTree object relative to the SilverStripe root.

By default, it this page is the current home page, and there is no action specified then this will return a link to the root of the site. However, if you set the $action parameter to TRUE then the link will not be rewritten and returned in its full form.

Parameters

$action
string $action

Returns

string
string

Uses

RootURLController::get_homepage_link()
public
# getAbsoluteLiveLink( mixed $includeStageEqualsLive = true )

Get the absolute URL for this page on the Live site.

Get the absolute URL for this page on the Live site.

public string
# ElementName( )

Return a CSS identifier generated from this page's link.

Return a CSS identifier generated from this page's link.

Returns

string
The URL segment
public boolean
# isCurrent( )

Returns TRUE if this is the currently active page that is being used to handle a request.

Returns TRUE if this is the currently active page that is being used to handle a request.

Returns

boolean
bool
public boolean
# isSection( )

Check if this page is in the currently active section (e.g. it is either current or one of it's children is currently being viewed.

Check if this page is in the currently active section (e.g. it is either current or one of it's children is currently being viewed.

Returns

boolean
bool
public string
# LinkOrCurrent( )

Return "link" or "current" depending on if this is the SiteTree::isCurrent() current page.

Return "link" or "current" depending on if this is the SiteTree::isCurrent() current page.

Returns

string
string
public string
# LinkOrSection( )

Return "link" or "section" depending on if this is the SiteTree::isSeciton() current section.

Return "link" or "section" depending on if this is the SiteTree::isSeciton() current section.

Returns

string
string
public string
# LinkingMode( )

Return "link", "current" or section depending on if this page is the current page, or not on the current page but in the current section.

Return "link", "current" or section depending on if this page is the current page, or not on the current page but in the current section.

Returns

string
string
public boolean
# InSection( string $sectionName )

Check if this page is in the given current section.

Check if this page is in the given current section.

Parameters

$sectionName
string $sectionName Name of the section to check.

Returns

boolean
True if we are in the given section.
public DataObjectSet
# Comments( )

Returns comments on this page. This will only show comments that have been marked as spam if "?showspam=1" is appended to the URL.

Returns comments on this page. This will only show comments that have been marked as spam if "?showspam=1" is appended to the URL.

Returns

DataObjectSet
Comments on this page.
public boolean
# allowComments( )

Allow Comments

Allow Comments

Returns

boolean
Permission for comments
public SiteTree
# duplicate( mixed $doWrite = true )

Create a duplicate of this node. Doesn't affect joined data - create a custom overloading of this if you need such behaviour.

Create a duplicate of this node. Doesn't affect joined data - create a custom overloading of this if you need such behaviour.

Parameters

$doWrite
$doWrite Perform a write() operation before returning the object. If this is true, it will create the duplicate in the database.

Returns

SiteTree
The duplicated object.

Overrides

DataObject::duplicate
public SiteTree
# duplicateWithChildren( )

Duplicates each child of this node recursively and returns the duplicate node.

Duplicates each child of this node recursively and returns the duplicate node.

Returns

SiteTree
The duplicated object.
public
# duplicateAsChild( integer $id )

Duplicate this node and its children as a child of the node with the given ID

Duplicate this node and its children as a child of the node with the given ID

Parameters

$id
int $id ID of the new node's new parent
public string
# Breadcrumbs( integer $maxDepth = 20, boolean $unlinked = false, string $stopAtPageType = false, boolean $showHidden = false )

Return a breadcrumb trail to this page. Excludes "hidden" pages (with ShowInMenus=0).

Return a breadcrumb trail to this page. Excludes "hidden" pages (with ShowInMenus=0).

Parameters

$maxDepth
int $maxDepth The maximum depth to traverse.
$unlinked
boolean $unlinked Do not make page names links
$stopAtPageType
string $stopAtPageType ClassName of a page to stop the upwards traversal.
$showHidden
boolean $showHidden Include pages marked with the attribute ShowInMenus = 0

Returns

string
The breadcrumb trail.
public
# setParent( SiteTree|integer $item )

Make this page a child of another page.

Make this page a child of another page.

If the parent page does not exist, resolve it to a valid ID before updating this page's reference.

Parameters

$item
SiteTree|int $item Either the parent object, or the parent ID
public SiteTree
# getParent( )

Get the parent of this page.

Get the parent of this page.

Returns

SiteTree
Parent of this page.
public string
# NestedTitle( integer $level = 2, string $separator = " - " )

Return a string of the form "parent - page" or "grandparent - parent - page".

Return a string of the form "parent - page" or "grandparent - parent - page".

Parameters

$level
int $level The maximum amount of levels to traverse.
$separator
string $seperator Seperating string

Returns

string
The resulting string
public boolean
# can( string $perm, Member $member = null )

This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application.

Returns true if the member is allowed to do the given action.

Parameters

$perm
string $perm The permission to be checked, such as 'View'.
$member
Member $member The member whose permissions need checking. Defaults to the currently logged in user.

Returns

boolean
True if the the member is allowed to do the given action.

Uses

DataObjectDecorator::can()
If a page is set to inherit, but has no parent, it inherits from {@link SiteConfig}

Overrides

DataObject::can
public boolean
# canAddChildren( mixed $member = null )

This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • alternateCanAddChildren() on a decorator returns FALSE
  • canEdit() is not granted
  • There are no classes defined in SiteTree::$allowed_children

Returns

boolean
True if the current user can add children.

Uses

SiteTreeDecorator::canAddChildren()
SiteTree::canEdit()
mixed
public boolean
# canView( Member $member = null )

This function should return true if the current user can view this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can view this page. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • canView() on any decorator returns FALSE
  • "CanViewType" directive is set to "Inherit" and any parent page return false for canView()
  • "CanViewType" directive is set to "LoggedInUsers" and no user is logged in
  • "CanViewType" directive is set to "OnlyTheseUsers" and user is not in the given groups

Parameters

$member
Member $member

Returns

boolean
True if the current user can view this page.

Uses

DataObjectDecorator->canView()
ViewerGroups()

Used by

SiteTree::canEdit()

Overrides

DataObject::canView
public boolean
# canDelete( Member $member = null )

This function should return true if the current user can delete this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can delete this page. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • canDelete() returns FALSE on any decorator
  • canEdit() returns FALSE
  • any descendant page returns FALSE for canDelete()

Parameters

$member
Member $member

Returns

boolean
True if the current user can delete this page.

Uses

SiteTree::canDelete()
DataObjectDecorator::canDelete()
SiteTree::canEdit()

Used by

SiteTree::canDelete()

Overrides

DataObject::canDelete
public boolean
# canCreate( Member $member = null )

This function should return true if the current user can create new pages of this class. It can be overloaded to customise the security model for an application.

This function should return true if the current user can create new pages of this class. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • canCreate() returns FALSE on any decorator
  • $can_create is set to FALSE and the site is not in "dev mode"

Use SiteTree::canAddChildren() to control behaviour of creating children under this page.

Parameters

$member
Member $member

Returns

boolean
True if the current user can create pages on this class.

Uses

mixed
DataObjectDecorator::canCreate()

Overrides

DataObject::canCreate
public boolean
# canEdit( Member $member = null )

This function should return true if the current user can edit this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can edit this page. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • canEdit() on any decorator returns FALSE
  • canView() return false
  • "CanEditType" directive is set to "Inherit" and any parent page return false for canEdit()
  • "CanEditType" directive is set to "LoggedInUsers" and no user is logged in or doesn't have the CMS_Access_CMSMAIN permission code
  • "CanEditType" directive is set to "OnlyTheseUsers" and user is not in the given groups

Parameters

$member
Member $member Set to FALSE if you want to explicitly test permissions without a valid user (useful for unit tests)

Returns

boolean
True if the current user can edit this page.

Uses

SiteTree::canView()
EditorGroups()
DataObjectDecorator::canEdit()

Used by

SiteTree::canAddChildren()
SiteTree::canDelete()

Overrides

DataObject::canEdit
public boolean
# canPublish( Member $member = null )

This function should return true if the current user can publish this page. It can be overloaded to customise the security model for an application.

This function should return true if the current user can publish this page. It can be overloaded to customise the security model for an application.

Denies permission if any of the following conditions is TRUE:

  • canPublish() on any decorator returns FALSE
  • canEdit() returns FALSE

Parameters

$member
Member $member

Returns

boolean
True if the current user can publish this page.

Uses

SiteTreeDecorator::canPublish()
public
# canDeleteFromLive( mixed $member = null )
public
# getSiteConfig( )

Stub method to get the site config, provided so it's easy to override

Stub method to get the site config, provided so it's easy to override

public static
# prepopuplate_permission_cache( mixed $permission = 'CanEditType', mixed $ids, mixed $batchCallback = null )

Pre-populate the cache of canEdit, canView, canDelete, canPublish permissions. This method will use the static can_(perm)_multiple method for efficiency.

Pre-populate the cache of canEdit, canView, canDelete, canPublish permissions. This method will use the static can_(perm)_multiple method for efficiency.

Parameters

$permission
$permission String The permission: edit, view, publish, approve, etc.
$ids
$ids array An array of page IDs
$batchCallback
$batchCallBack The function/static method to call to calculate permissions. Defaults to 'SiteTree::can_(permission)_multiple'
public static
# batch_permission_check( mixed $ids, mixed $memberID, mixed $typeField, mixed $groupJoinTable, mixed $siteConfigMethod, mixed $globalPermission = 'CMS_ACCESS_CMSMain', mixed $useCached = true )
public static A
# can_edit_multiple( An $ids, useCached $memberID, mixed $useCached = true )

Get the 'can edit' information for a number of SiteTree pages.

Get the 'can edit' information for a number of SiteTree pages.

Parameters

$ids
An array of IDs of the SiteTree pages to look up.
$memberID
useCached Return values from the permission cache if they exist.
$useCached

Returns

A
map where the IDs are keys and the values are booleans stating whether the given page can be edited.
public static
# can_delete_multiple( An $ids, useCached $memberID, mixed $useCached = true )

Get the 'can edit' information for a number of SiteTree pages.

Get the 'can edit' information for a number of SiteTree pages.

Parameters

$ids
An array of IDs of the SiteTree pages to look up.
$memberID
useCached Return values from the permission cache if they exist.
$useCached
public
# collateDescendants( string $condition, array & $collator )

Collate selected descendants of this page.

Collate selected descendants of this page.

$condition will be evaluated on each descendant, and if it is succeeds, that item will be added to the $collator array.

Parameters

$condition
string $condition The PHP condition to be evaluated. The page will be called $item
$collator
array $collator An array, passed by reference, to collect all of the matching descendants.
public string
# MetaTags( boolean|string $includeTitle = true )

Return the title, description, keywords and language metatags.

Return the title, description, keywords and language metatags.

Parameters

$includeTitle
boolean|string $includeTitle Show default <title>-tag, set to false for custom templating

Returns

string
The XHTML metatags
public SiteTree
# ContentSource( )

Returns the object that contains the content that a user would associate with this page.

Returns the object that contains the content that a user would associate with this page.

Ordinarily, this is just the page itself, but for example on RedirectorPages or VirtualPages ContentSource() will return the page that is linked to.

Returns

SiteTree
The content source.
public
# requireDefaultRecords( )

Add default records to database.

Add default records to database.

This function is called whenever the database is built, after the database tables have all been created. Overload this to add default records when the database is built, but make sure you call parent::requireDefaultRecords().

Overrides

DataObject::requireDefaultRecords
protected
# onBeforeWrite( )

Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though!

Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though!

This called after $this->validate(), so you can be sure that your data is valid.

Uses

DataObjectDecorator::onBeforeWrite()

Overrides

DataObject::onBeforeWrite
public
# syncLinkTracking( )
public
# onAfterWrite( )

Event handler called after writing to the database. You can overload this to act upon changes made to the data after it is written. $this->changed will have a record database. Don't forget to call parent::onAfterWrite(), though!

Event handler called after writing to the database. You can overload this to act upon changes made to the data after it is written. $this->changed will have a record database. Don't forget to call parent::onAfterWrite(), though!

Uses

DataObjectDecorator::onAfterWrite()

Overrides

DataObject::onAfterWrite
public
# onBeforeDelete( )

Event handler called before deleting from the database. You can overload this to clean up or otherwise process data before delete this record. Don't forget to call parent::onBeforeDelete(), though!

Event handler called before deleting from the database. You can overload this to clean up or otherwise process data before delete this record. Don't forget to call parent::onBeforeDelete(), though!

Uses

DataObjectDecorator::onBeforeDelete()

Overrides

DataObject::onBeforeDelete
public
# onAfterDelete( )

Overrides

DataObject::onAfterDelete
public boolean
# validURLSegment( )

Returns TRUE if this object has a URLSegment value that does not conflict with any other objects. This methods checks for:
- A page with the same URLSegment that has a conflict.
- Conflicts with actions on the parent page.
- A conflict caused by a root page having the same URLSegment as a class name.

Returns TRUE if this object has a URLSegment value that does not conflict with any other objects. This methods checks for: - A page with the same URLSegment that has a conflict. - Conflicts with actions on the parent page. - A conflict caused by a root page having the same URLSegment as a class name.

Returns

boolean
bool
public string
# generateURLSegment( string $title )

Generate a URL segment based on the title provided.

Generate a URL segment based on the title provided.

Parameters

$title
string $title Page title.

Returns

string
Generated url segment
public
# rewriteFileURL( mixed $old, mixed $new )

Rewrite a file URL on this page, after its been renamed. Triggers the onRenameLinkedAsset action on extensions.

Rewrite a file URL on this page, after its been renamed. Triggers the onRenameLinkedAsset action on extensions.

public
# DependentPages( mixed $includeVirtuals = true )

Returns the pages that depend on this page. This includes virtual pages, pages that link to it, etc.

Returns the pages that depend on this page. This includes virtual pages, pages that link to it, etc.

Parameters

$includeVirtuals
$includeVirtuals Set to false to exlcude virtual pages.
public
# DependentPagesCount( mixed $includeVirtuals = true )

Return the number of SiteTree::DependentPages()

Return the number of SiteTree::DependentPages()

Parameters

$includeVirtuals
$includeVirtuals Set to false to exlcude virtual pages.
public
# VirtualPages( )

Return all virtual pages that link to this page

Return all virtual pages that link to this page

public FieldSet
# getCMSFields( )

Returns a FieldSet with which to create the CMS editing form.

Returns a FieldSet with which to create the CMS editing form.

You can override this in your child classes to add extra fields - first get the parent fields using parent::getCMSFields(), then use addFieldToTab() on the FieldSet.

Returns

FieldSet
The fields to be displayed in the CMS.

Overrides

DataObject::getCMSFields
public array|string
# fieldLabels( boolean $includerelations = true )

Parameters

$includerelations
boolean $includerelations a boolean value to indicate if the labels returned include relation fields

Returns

array|string
Array of all element labels if no argument given, otherwise the label of the field

Overrides

DataObject::fieldLabels
public FieldSet
# getCMSActions( )

Get the actions available in the CMS for this page - eg Save, Publish.

Get the actions available in the CMS for this page - eg Save, Publish.

Returns

FieldSet
The available actions for this page.

Overrides

DataObject::getCMSActions
public
# doPublish( )

Publish this page.

Publish this page.

Uses

SiteTreeDecorator::onBeforePublish()
SiteTreeDecorator::onAfterPublish()
public static
# generate_homepage_domain_map( )
public
# doUnpublish( )

Unpublish this page - remove it from the live site

Unpublish this page - remove it from the live site

Uses

SiteTreeDecorator::onBeforeUnpublish()
SiteTreeDecorator::onAfterUnpublish()
public
# doRollbackTo( mixed $version )

Roll the draft version of this page to match the published page. Caution: Doesn't overwrite the object properties with the rolled back version.

Roll the draft version of this page to match the published page. Caution: Doesn't overwrite the object properties with the rolled back version.

Parameters

$version
$version Either the string 'Live' or a version number
public
# doRevertToLive( )

Revert the draft changes: replace the draft content with the content on live

Revert the draft changes: replace the draft content with the content on live

Used by

CMSMain::revert()
public The
# doRestoreToStage( )

Restore the content in the active copy of this SiteTree page to the stage site.

Restore the content in the active copy of this SiteTree page to the stage site.

Returns

The
SiteTree object.
public
# doDeleteFromLive( )

Synonym of SiteTree::doUnpublish()

Synonym of SiteTree::doUnpublish()

public boolean
# isNew( )

Check if this page is new - that is, if it has yet to have been written to the database.

Check if this page is new - that is, if it has yet to have been written to the database.

Returns

boolean
True if this page is new.
public boolean
# isPublished( )

Check if this page has been published.

Check if this page has been published.

Returns

boolean
True if this page has been published.
protected array
# getClassDropdown( )

Get the class dropdown used in the CMS to change the class of a page. This returns the list of options in the drop as a Map from class name to text in dropdown.

Get the class dropdown used in the CMS to change the class of a page. This returns the list of options in the drop as a Map from class name to text in dropdown.

Returns

array
array
public array
# allowedChildren( )

Returns an array of the class names of classes that are allowed to be children of this class.

Returns an array of the class names of classes that are allowed to be children of this class.

Returns

array
array
public string
# defaultChild( )

Returns the class name of the default class for children of this page.

Returns the class name of the default class for children of this page.

Returns

string
string
public string
# defaultParent( )

Returns the class name of the default class for the parent of this page.

Returns the class name of the default class for the parent of this page.

Returns

string
string
public
# cmsCleanup_parentChanged( )

Function to clean up the currently loaded page after a reorganise has been called. It should return a piece of JavaScript to be executed on the client side, to clean up the results of the reorganise.

Function to clean up the currently loaded page after a reorganise has been called. It should return a piece of JavaScript to be executed on the client side, to clean up the results of the reorganise.

public string
# getMenuTitle( )

Get the title for use in menus for this page. If the MenuTitle field is set it returns that, else it returns the Title field.

Get the title for use in menus for this page. If the MenuTitle field is set it returns that, else it returns the Title field.

Returns

string
string
public
# setMenuTitle( string $value )

Set the menu title for this page.

Set the menu title for this page.

Parameters

$value
string $value
public string
# TreeTitle( )

TitleWithStatus will return the title in an <ins>, <del> or <span class=\"modified\"> tag depending on its publication status.

TitleWithStatus will return the title in an <ins>, <del> or <span class=\"modified\"> tag depending on its publication status.

Returns

string
string
public
# Level( mixed $level )

Returns the page in the current page stack of the given level. Level(1) will return the main menu item that we're currently inside, etc.

Returns the page in the current page stack of the given level. Level(1) will return the main menu item that we're currently inside, etc.

public string
# CMSTreeClasses( Controller $controller )

Return the CSS classes to apply to this node in the CMS tree

Return the CSS classes to apply to this node in the CMS tree

Parameters

$controller
Controller $controller The controller object that the tree appears on

Returns

string
string
public boolean
# getIsDeletedFromStage( )

Compares current draft with live version, and returns TRUE if no draft version of this page exists, but the page is still published (after triggering "Delete from draft site" in the CMS).

Compares current draft with live version, and returns TRUE if no draft version of this page exists, but the page is still published (after triggering "Delete from draft site" in the CMS).

Returns

boolean
boolean
public
# getExistsOnLive( )

Return true if this page exists on the live site

Return true if this page exists on the live site

public boolean
# getIsModifiedOnStage( )

Compares current draft with live version, and returns TRUE if these versions differ, meaning there have been unpublished changes to the draft site.

Compares current draft with live version, and returns TRUE if these versions differ, meaning there have been unpublished changes to the draft site.

Returns

boolean
boolean
public boolean
# getIsAddedToStage( )

Compares current draft with live version, and returns true if no live version exists, meaning the page was never published.

Compares current draft with live version, and returns true if no live version exists, meaning the page was never published.

Returns

boolean
boolean
public static
# disableCMSFieldsExtensions( )

Stops extendCMSFields() being called on getCMSFields(). This is useful when you need access to fields added by subclasses of SiteTree in a decorator. Call before calling parent::getCMSFields(), and reenable afterwards.

Stops extendCMSFields() being called on getCMSFields(). This is useful when you need access to fields added by subclasses of SiteTree in a decorator. Call before calling parent::getCMSFields(), and reenable afterwards.

Overrides

DataObject::disableCMSFieldsExtensions
public static
# enableCMSFieldsExtensions( )

Reenables extendCMSFields() being called on getCMSFields() after it has been disabled by disableCMSFieldsExtensions().

Reenables extendCMSFields() being called on getCMSFields() after it has been disabled by disableCMSFieldsExtensions().

Overrides

DataObject::enableCMSFieldsExtensions
public
# providePermissions( )

Return a map of permission codes to add to the dropdown shown in the Security section of the CMS. array(
'VIEW_SITE' => 'View the site', );

Return a map of permission codes to add to the dropdown shown in the Security section of the CMS. array( 'VIEW_SITE' => 'View the site', );

Implementation of

PermissionProvider::providePermissions()
public String
# i18n_singular_name( )

Return the translated Singular name

Return the translated Singular name

Returns

String
String

Overrides

DataObject::i18n_singular_name
public array
# provideI18nEntities( )

Overloaded to also provide entities for 'Page' class which is usually located in custom code, hence textcollector picks it up for the wrong folder.

Overloaded to also provide entities for 'Page' class which is usually located in custom code, hence textcollector picks it up for the wrong folder.

Returns

array
A numerical array which contains one or more entities in array-form. Each numeric entity array contains the "arguments" for a _t() call as array values: $entity, $string, $priority, $context.

Overrides

DataObject::provideI18nEntities

Implementation of

i18nEntityProvider::provideI18nEntities()
public
# getParentType( )
public static
# reset( )

Reset internal caches, for example after test runs

Reset internal caches, for example after test runs

Overrides

DataObject::reset

Methods inherited from DataObject

Aggregate(), RelationshipAggregate(), __construct(), baseTable(), belongs_to(), buildDataObjectSet(), buildSQL(), castedUpdate(), composite_fields(), context_obj(), customDatabaseFields(), custom_database_fields(), data(), databaseFields(), databaseIndexes(), database_extensions(), database_fields(), db(), dbObject(), debug(), defaultSearchFilters(), defineMethods(), delete(), delete_by_id(), destroy(), disable_subclass_access(), enable_subclass_access(), exists(), extendedSQL(), fieldLabel(), flushCache(), flush_and_destroy_cache(), forceChange(), get(), getAllFields(), getChangedFields(), getClassAncestry(), getComponent(), getComponents(), getComponentsQuery(), getDefaultSearchContext(), getField(), getFrontEndFields(), getManyManyComponents(), getManyManyComponentsQuery(), getManyManyFilter(), getManyManyJoin(), getRemoteJoinField(), getReverseAssociation(), getTitle(), get_by_id(), get_one(), get_validation_enabled(), hasDatabaseField(), hasField(), hasOwnTableDatabaseField(), hasValue(), has_many(), has_one(), has_own_table(), i18n_plural_name(), inheritedDatabaseFields(), instance_get(), instance_get_one(), isChanged(), isEmpty(), isInDB(), is_composite_field(), many_many(), many_many_extraFields(), merge(), newClassInstance(), plural_name(), populateDefaults(), relObject(), requireTable(), scaffoldFormFields(), scaffoldSearchFields(), searchableFields(), setCastedField(), setClassName(), setComponent(), setField(), set_context_obj(), set_validation_enabled(), singular_name(), summaryFields(), toMap(), update(), validate(), write(), writeComponents(), writeWithoutVersion()

Methods inherited from ViewableData

ATT_val(), BaseHref(), CSSClasses(), ColumnBreak(), ColumnCalc(), ColumnNumber(), ColumnPad(), ColumnPos(), CurrentMember(), CurrentPage(), Debug(), Even(), EvenOdd(), First(), FirstLast(), HasPerm(), IsAjax(), JS_val(), Last(), Me(), Middle(), MiddleString(), Modulus(), MultipleOf(), Odd(), Pos(), RAW_val(), SQL_val(), ThemeDir(), ThemeName(), Top(), TotalItems(), XML_val(), __get(), __isset(), __set(), buildCastingCache(), cachedCall(), castingClass(), castingHelper(), castingHelperPair(), castingObjectCreator(), castingObjectCreatorPair(), customise(), escapeTypeForField(), getIterator(), getSecurityID(), getXMLValues(), i18nLocale(), iteratorProperties(), obj(), renderWith(), setCustomisedObj()

Methods inherited from Object

__call(), __toString(), __wakeup(), addMethodsFrom(), addStaticVars(), addWrapperMethod(), add_extension(), add_static_var(), allMethodNames(), cacheToFile(), cacheToFileWithArgs(), clearCache(), combined_static(), create(), createMethod(), create_from_string(), extInstance(), extend(), getCustomClass(), getExtensionInstance(), getExtensionInstances(), get_extensions(), get_static(), hasExtension(), hasMethod(), has_extension(), invokeWithExtensions(), is_a(), loadCache(), parentClass(), parse_class_spec(), remove_extension(), sanitiseCachename(), saveCache(), set_stat(), set_static(), set_uninherited(), stat(), strong_create(), uninherited(), uninherited_static(), useCustomClass()

Magic methods summary

Properties summary

public static array $allowed_children
#

Indicates what kind of children this page type can have. This can be an array of allowed child classes, or the string "none" - indicating that this page type can't have children. If a classname is prefixed by "*", such as "*Page", then only that class is allowed - no subclasses. Otherwise, the class and all its subclasses are allowed.

Indicates what kind of children this page type can have. This can be an array of allowed child classes, or the string "none" - indicating that this page type can't have children. If a classname is prefixed by "*", such as "*Page", then only that class is allowed - no subclasses. Otherwise, the class and all its subclasses are allowed.

Used by

SiteTree::canAddChildren()
public static string $default_child
#

The default child class for this page.

The default child class for this page.

public static string $default_parent
#

The default parent class for this page.

The default parent class for this page.

public static boolean $can_be_root
#

Controls whether a page can be in the root of the site tree.

Controls whether a page can be in the root of the site tree.

public static array $need_permission
#

List of permission codes a user can have to allow a user to create a page of this type.

List of permission codes a user can have to allow a user to create a page of this type.

public static string $hide_ancestor
#

If you extend a class, and don't want to be able to select the old class in the cms, set this to the old class name. Eg, if you extended Product to make ImprovedProduct, then you would set $hide_ancestor to Product.

If you extend a class, and don't want to be able to select the old class in the cms, set this to the old class name. Eg, if you extended Product to make ImprovedProduct, then you would set $hide_ancestor to Product.

public static array $db
#

Database field definitions. This is a map from field names to field type. The field type should be a class that extends .

Database field definitions. This is a map from field names to field type. The field type should be a class that extends .

public static array $indexes
#

If a field is in this array, then create a database index on that field. This is a map from fieldname to index type. See SS_Database->requireIndex() and custom subclasses for details on the array notation.

If a field is in this array, then create a database index on that field. This is a map from fieldname to index type. See SS_Database->requireIndex() and custom subclasses for details on the array notation.

public static array $has_many
#

This defines a one-to-many relationship. It is a map of component name to the remote data class.

This defines a one-to-many relationship. It is a map of component name to the remote data class.

This relationship type does not actually create a data structure itself - you need to define a matching $has_one relationship on the child class. Also, if the $has_one relationship on the child class has multiple links to this class you can use the syntax "ClassName.HasOneRelationshipName" in the remote data class definition to show which foreign key to use.

public static array $many_many
#

many-many relationship definitions. This is a map from component name to data type.

many-many relationship definitions. This is a map from component name to data type.

public static array $belongs_many_many
#

The inverse side of a many-many relationship. This is a map from component name to data type.

The inverse side of a many-many relationship. This is a map from component name to data type.

public static array $many_many_extraFields
#

Extra fields to include on the connecting many-many table. This is a map from field name to field type.

Extra fields to include on the connecting many-many table. This is a map from field name to field type.

Example code:

public static $many_many_extraFields = array(
        'Members' => array(
                'Role' => 'Varchar(100)'
        )
);
public static array $casting
#

Use a casting object for a field. This is a map from field name to class name of the casting object.

Use a casting object for a field. This is a map from field name to class name of the casting object.

public static array $defaults
#

Inserts standard column-values when a DataObject is instanciated. Does not insert default records DataObject::$default_records. This is a map from fieldname to default value.

Inserts standard column-values when a DataObject is instanciated. Does not insert default records DataObject::$default_records. This is a map from fieldname to default value.

  • If you would like to change a default value in a sub-class, just specify it. - If you would like to disable the default value given by a parent class, set the default value to 0,'',or false in your subclass. Setting it to null won't work.
public static array $has_one
#

One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a DataObject::$belongs_to relationship on the child class.

One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a DataObject::$belongs_to relationship on the child class.

Note that you cannot have a has_one and belongs_to relationship with the same name.

public static array $versioning
#
public static string $default_sort
#

The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided.

The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided.

public static boolean $can_create
#

If this is false, the class cannot be created in the CMS.

If this is false, the class cannot be created in the CMS.

Used by

SiteTree::canCreate()
public static string|array $icon
#

Icon to use in the CMS

Icon to use in the CMS

This should be the base filename. The suffixes -file.gif,

  • openfolder.gif and -closedfolder.gif will be appended to the base name

that you provide there. If you prefer, you can pass an array: array("sapphire\thirdparty\tree\images\page", $option). $option can be either "file" or "folder" to force the icon to always be a file or folder, regardless of whether the page has children or not

public static array $extensions
#

An array of extension names and parameters to be applied to this object upon construction.

An array of extension names and parameters to be applied to this object upon construction.

Example:

public static $extensions = array (
  'Hierachy',
  "Version('Stage', 'Live')"
);

Use Object::add_extension() to add extensions without access to the class code, e.g. to extend core classes.

Extensions are instanciated together with the object and stored in Object::$extension_instances.

public static string $breadcrumbs_delimiter
#

Delimit breadcrumb-links generated by BreadCrumbs()

Delimit breadcrumb-links generated by BreadCrumbs()

public static boolean $write_homepage_map
#

Whether or not to write the homepage map for static publisher

Whether or not to write the homepage map for static publisher

public static array $searchable_fields
#

Default list of fields that can be scaffolded by the ModelAdmin search interface.

Default list of fields that can be scaffolded by the ModelAdmin search interface.

Overriding the default filter, with a custom defined filter:

       static $searchable_fields = array(
          "Name" => "PartialMatchFilter"
);

Overriding the default form fields, with a custom defined field. The 'filter' parameter will be generated from DBField::$default_search_filter_class. The 'title' parameter will be generated from DataObject->fieldLabels().

       static $searchable_fields = array(
          "Name" => array(
                       "field" => "TextField"
               )
);

Overriding the default form field, filter and title:

       static $searchable_fields = array(
          "Organisation.ZipCode" => array(
                       "field" => "TextField",
                       "filter" => "PartialMatchFilter",
                       "title" => 'Organisation ZIP'
               )
);
public static array $cache_permissions
#

Cache for canView/Edit/Publish/Delete permissions

Cache for canView/Edit/Publish/Delete permissions

Properties inherited from DataObject

$allowed_actions, $ancestry, $api_access, $belongs_to, $brokenOnDelete, $brokenOnWrite, $cache_get_one, $cache_has_own_table, $cache_has_own_table_field, $componentCache, $components, $create_table_options, $default_records, $destroyed, $field_labels, $original, $plural_name, $record, $singular_name, $summary_fields

Properties inherited from ViewableData

$customisedObject, $default_cast, $failover, $iteratorPos, $iteratorTotalItems

Properties inherited from Object

$class, $extension_instances

[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. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0