class BasePage extends SiteTree (View source)

BasePage is a foundation page class which can be used for constructing your own page types. By default it is hidden from the CMS - we rely on developers creating their own Page class in mysite/code which will extend from BasePage.

Please note: you should generally always extend Page with your custom page types. Refrain from subclassing BasePage directly. Doing so will omit Page from your custom class's hierarchy, and this can have unintended side effects where modules rely on modifying things on the Page class, as well as with templates and themes.

Traits

Allows an object to have extensions applied to it.

A class that can be instantiated or replaced via DI

Provides extensions to this object to integrate it with standard config API methods.

Allows an object to declare a set of custom methods

Constants

CHANGE_NONE

Represents a field that hasn't changed (before === after, thus before == after)

CHANGE_STRICT

Represents a field that has changed type, although not the loosely defined value.

(before !== after && before == after) E.g. change 1 to true or "true" to true, but not true to 0. Value changes are by nature also considered strict changes.

CHANGE_VALUE

Represents a field that has changed the loosely defined value (before != after, thus, before !== after)) E.g. change false to true, but not false to 0

CREATE_OBJECT

Value for 2nd argument to constructor, indicating that a new record is being created Setters will be called on fields passed, and defaults will be populated

CREATE_SINGLETON

Value for 2nd argument to constructor, indicating that a record is a singleton representing the whole type, e.g. to call requireTable() in dev/build Defaults will not be populated and data passed will be ignored

CREATE_HYDRATED

Value for 2nd argument to constructor, indicating that a record is being hydrated from the database Setter methods are not called, and population via private static $defaults will not occur.

CREATE_MEMORY_HYDRATED

Value for 2nd argument to constructor, indicating that a record is being hydrated from memory. This can be used to initialised a record that doesn't yet have an ID. Setter methods are not called, and population via private static $defaults will not occur.

Config options

extensions array

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

from  Extensible
unextendable_classes array

Classes that cannot be extended

from  Extensible
casting from  SiteTree
default_cast string

The default object to cast scalar fields to if casting information is not specified, and casting to an object is required.

from  ViewableData
casting_cache array from  ViewableData
singular_name string

Human-readable singular name.

from  DataObject
plural_name
api_access
default_classname string

Default value for SiteTree.ClassName enum {DBClassName::getDefault}

from  SiteTree
validation_enabled bool

Should dataobjects be validated before they are written?

from  DataObject
fixed_fields array

Base fields which are not defined in static $db

from  DataObject
table_name
cascade_deletes from  SiteTree
cascade_duplicates array

List of relations that should be cascade duplicate.

from  DataObject
subclass_access from  DataObject
db from  SiteTree
create_table_options array

Specify custom options for a CREATE TABLE call.

from  DataObject
indexes from  SiteTree
defaults from  SiteTree
default_records array

Multidimensional array which inserts default data into the database on a db/build-call as long as the database-table is empty. Please use this only for simple constructs, not for SiteTree-Objects etc. which need special behaviour such as publishing and ParentNodes.

from  DataObject
has_one array

One-to-zero relationship definition. 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.

from  DataObject
belongs_to array

A meta-relationship that allows you to define the reverse side of a DataObject::$has_one.

from  DataObject
has_many from  SiteTree
many_many
many_many_extraFields array
belongs_many_many
default_sort from  SiteTree
searchable_fields from  SiteTree
general_search_field_name string

Name of the field which is used as a stand-in for searching across all searchable fields.

from  DataObject
general_search_field_filter string

The search filter to use when searching with the general search field.

from  DataObject
general_search_split_terms bool

If true, the search phrase is split into individual terms, and checks all searchable fields for each search term.

from  DataObject
field_labels from  SiteTree
summary_fields array

Provides a default list of fields to be used by a 'summary' view of this object.

from  DataObject
allowed_children array

Indicates what kind of children this page type can have.

from  SiteTree
default_child string

The default child class for this page.

from  SiteTree
default_parent string

The default parent class for this page.

from  SiteTree
can_be_root bool

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

from  SiteTree
need_permission array

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

from  SiteTree
hide_ancestor

Hide this page type from the CMS. hide_ancestor is slightly misnamed, should really be just "hide"

controller_name string

You can define the class of the controller that maps to your SiteTree object here if you don't want to rely on the magic of appending Controller to the Classname

from  SiteTree
cms_edit_owner string

The class of the LeftAndMain controller where this class is managed.

from  SiteTree
namespace_map string

You can define the a map of Page namespaces to Controller namespaces here This will apply after the magic of appending Controller, and in order Must be applied to SiteTree config e.g.

from  SiteTree
owned_by from  SiteTree
versioning from  SiteTree
can_create bool

If this is false, the class cannot be created in the CMS by regular content authors, only by ADMINs.

from  SiteTree
icon string

Icon to use in the CMS page tree. This should be the full filename, relative to the webroot.

from  SiteTree
icon_class string

Class attached to page icons in the CMS page tree. Also supports font-icon set.

from  SiteTree
nested_urls from  SiteTree
create_default_pages from  SiteTree
runCMSFieldsExtensions

This controls whether of not extendCMSFields() is called by getCMSFields.

from  SiteTree
enforce_strict_hierarchy bool

Deleting this page also deletes all its children when set to true.

from  SiteTree
meta_generator string

The value used for the meta generator tag. Leave blank to omit the tag.

from  SiteTree
show_meta_generator_version bool

Whether to display the version portion of the meta generator tag Set to false if it's viewed as a concern.

from  SiteTree
base_plural_name string

Plural form for SiteTree / Page classes. Not inherited by subclasses.

from  SiteTree
base_singular_name string

Plural form for SiteTree / Page classes. Not inherited by subclasses.

from  SiteTree
description string

Description of the class functionality, typically shown to a user when selecting which page type to create. Translated through provideI18nEntities().

from  SiteTree
base_description string

Description for Page and SiteTree classes, but not inherited by subclasses.

from  SiteTree
dependencies array from  SiteTree
owns

Properties

protected static array $extra_methods

Custom method sources

from  CustomMethods
protected array $extra_method_registers

Name of methods to invoke by defineMethods for this instance

from  CustomMethods
protected static array $built_in_methods

Non-custom methods

from  CustomMethods
protected Extension[] $extension_instances from  Extensible
protected callable[][] $beforeExtendCallbacks

List of callbacks to call prior to extensions having extend called on them, each grouped by methodName.

from  Extensible
protected callable[][] $afterExtendCallbacks

List of callbacks to call after extensions having extend called on them, each grouped by methodName.

from  Extensible
protected ViewableData $failover

A failover object to attempt to get data from if it is not present on this object.

from  ViewableData
protected ViewableData $customisedObject from  ViewableData
public deprecated bool $destroyed from  DataObject
protected array $record

Data stored in this objects database record. An array indexed by fieldname.

from  DataObject
protected DataObject $joinRecord

If selected through a many_many through relation, this is the instance of the through record

from  DataObject
protected array $original

The database record (in the same format as $record), before any changes.

from  DataObject
protected bool $brokenOnDelete

Used by onBeforeDelete() to ensure child classes call parent::onBeforeDelete()

from  DataObject
protected bool $brokenOnWrite

Used by onBeforeWrite() to ensure child classes call parent::onBeforeWrite()

from  DataObject
protected static array $_cache_get_one

Static caches used by relevant functions.

from  DataObject
protected static array $_cache_field_labels

Cache of field labels

from  DataObject
protected DataObject[] $components

Non-static relationship cache, indexed by component name.

from  DataObject
protected UnsavedRelationList[] $unsavedRelations

Non-static cache of has_many and many_many relations that can't be written until this object is saved.

from  DataObject
protected array $sourceQueryParams from  DataObject
int $ID

ID of the DataObject, 0 if the DataObject doesn't exist in database.

from  DataObject
int $OldID

ID of object, if deleted

from  DataObject
string $Title from  SiteTree
string $ClassName

Class name of the DataObject

from  DataObject
string $LastEdited

Date and time of DataObject's last modification.

from  DataObject
string $Created

Date and time of DataObject creation.

from  DataObject
string $ObsoleteClassName

If ClassName no longer exists this will be set to the legacy value

from  DataObject
protected static array $_allowedChildren

Used as a cache for self::allowedChildren() Drastically reduces admin page load when there are a lot of page types

from  SiteTree
protected $_cache_statusFlags from  SiteTree
protected CacheInterface $creatableChildrenCache from  SiteTree
string $URLSegment from  SiteTree
string $MenuTitle from  SiteTree
string $Content

HTML content of the page.

from  SiteTree
string $MetaDescription from  SiteTree
string $ExtraMeta from  SiteTree
string $ReportClass from  SiteTree
int $Sort

Integer value denoting the sort order.

from  SiteTree
bool $ShowInMenus from  SiteTree
bool $ShowInSearch from  SiteTree
bool $HasBrokenFile

True if this page has a broken file shortcode

from  SiteTree
bool $HasBrokenLink

True if this page has a broken page shortcode

from  SiteTree

Methods

public
mixed
__call(string $method, array $arguments)

Attempts to locate and call a method dynamically added to a class at runtime if a default cannot be located

protected
defineMethods()

Adds any methods from Extension instances attached to this object.

protected
registerExtraMethodCallback(string $name, callable $callback)

Register an callback to invoke that defines extra methods

public
bool
hasMethod(string $method)

Return TRUE if a method exists on this object

protected
array
getExtraMethodConfig(string $method)

Get meta-data details on a named method

public
array
allMethodNames(bool $custom = false)

Return the names of all the methods available on this object

protected
array
findMethodsFromExtension(object $extension) deprecated

No description

protected
addMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an Extension) to this object.

protected
removeMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an Extension) to this object.

protected
addWrapperMethod(string $method, string $wrap)

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

protected
addCallbackMethod(string $method, callable $callback)

Add callback as a method.

protected
beforeExtending(string $method, callable $callback)

Allows user code to hook into Object::extend prior to control being delegated to extensions. Each callback will be reset once called.

protected
afterExtending(string $method, callable $callback)

Allows user code to hook into Object::extend after control being delegated to extensions. Each callback will be reset once called.

protected
constructExtensions() deprecated

No description

protected
defineExtensionMethods()

Adds any methods from Extension instances attached to this object.

public static 
bool
add_extension(string $classOrExtension, string $extension = null)

Add an extension to a specific class.

public static 
remove_extension(string $extension)

Remove an extension from a class.

public static 
array
get_extensions(string $class = null, bool $includeArgumentString = false)

No description

public static 
array|null
get_extra_config_sources(string $class = null)

Get extra config sources for this class

public static 
bool
has_extension(string $classOrExtension, string $requiredExtension = null, bool $strict = false)

Return TRUE if a class has a specified extension.

public
array
invokeWithExtensions(string $method, mixed $a1 = null, mixed $a2 = null, mixed $a3 = null, mixed $a4 = null, mixed $a5 = null, mixed $a6 = null, mixed $a7 = null)

Calls a method if available on both this object and all applied Extensions, and then attempts to merge all results into an array

public
array
extend(string $method, mixed $a1 = null, mixed $a2 = null, mixed $a3 = null, mixed $a4 = null, mixed $a5 = null, mixed $a6 = null, mixed $a7 = null)

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

public
Extension|null
getExtensionInstance(string $extension)

Get an extension instance attached to this object by name.

public
bool
hasExtension(string $extension)

Returns TRUE if this object instance has a specific extension applied in $extension_instances. Extension instances are initialized at constructor time, meaning if you use add_extension() afterwards, the added extension will just be added to new instances of the extended class. Use the static method has_extension() to check if a class (not an instance) has a specific extension.

public
getExtensionInstances()

Get all extension instances for this specific object instance.

public static 
create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

public static 
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
stat(string $name) deprecated

Get inherited config value

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

public
__construct(array $record = [], int|bool $creationType = self::CREATE_OBJECT, array $queryParams = [])

Construct a new DataObject.

public
bool
__isset(string $property)

Check if a field exists on this object or its failover.

public
mixed
__get(string $property)

Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using ViewableData::getField(), then fall back on a failover object.

public
__set(string $property, mixed $value)

Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the ViewableData::setField() method.

public
setFailover(ViewableData $failover)

Set a failover object to attempt to get data from if it is not present on this object.

public
getFailover()

Get the current failover object if set

public
bool
hasField(string $field)

Returns true if the given field exists in a database column on any of the objects tables and optionally look up a dynamic getter with get().

public
mixed
getField(string $field)

Gets the value of a field.

public
$this
setField(string $fieldName, mixed $val)

Set the value of the field Called by __set() and any setFieldName() methods you might create.

public
customise(array|ViewableData $data)

Merge some arbitrary data in with this object. This method returns a ViewableData_Customised instance with references to both this and the new custom data.

public
bool
exists()

Returns true if this object "exists", i.e., has a sensible value.

public
string
__toString()

No description

public
getCustomisedObj()

No description

public
setCustomisedObj(ViewableData $object)

No description

public
string
castingHelper(string $field)

Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. This helper will be a subclass of DBField.

public
string
castingClass(string $field)

Get the class name a field on this object will be casted to.

public
string
escapeTypeForField(string $field)

Return the string-format type for the given field.

public
renderWith(string|array|SSViewer $template, array $customFields = null)

Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter:

  • a template name (e.g. Page)
  • an array of possible template names - the first valid one will be used
  • an SSViewer instance

protected
string
objCacheName(string $fieldName, array $arguments)

Generate the cache name for a field

protected
mixed
objCacheGet(string $key)

Get a cached value from the field cache

protected
$this
objCacheSet(string $key, mixed $value)

Store a value in the field cache

protected
$this
objCacheClear()

Clear object cache

public
object|DBField
obj(string $fieldName, array $arguments = [], bool $cache = false, string $cacheName = null)

Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified.

public
object|DBField
cachedCall(string $field, array $arguments = [], string $identifier = null)

A simple wrapper around ViewableData::obj() that automatically caches the result so it can be used again without re-running the method.

public
bool
hasValue(string $field, array $arguments = null, bool $cache = true)

Returns true if the given method/parameter has a value (Uses the DBField::hasValue if the parameter is a database field)

public
string
XML_val(string $field, array $arguments = [], bool $cache = false)

Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template.

public
array
getXMLValues(array $fields)

Get an array of XML-escaped values by field name

public
getIterator()

Return a single-item iterator so you can iterate over the fields of a single record.

public
array
getViewerTemplates(string $suffix = '')

Find appropriate templates for SSViewer to use to render this object

public
Me()

When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself.

public
string
ThemeDir() deprecated

Return the directory if the current active theme (relative to the site root).

public
string
CSSClasses(string $stopAtClass = self::class)

Get part of the current classes ancestry to be used as a CSS class.

public
Debug()

Return debug information about this object that can be rendered into a template

public static 
getSchema()

Get schema object

public
destroy()

Destroy all of this objects dependent objects and local caches.

public
duplicate(bool $doWrite = true, array|null|false $relations = null)

Create a duplicate of this node. Can duplicate many_many relations

protected
duplicateRelations(DataObject $sourceObject, DataObject $destinationObject, array $relations)

Copies the given relations from this object to the destination

protected
duplicateManyManyRelations(DataObject $sourceObject, DataObject $destinationObject, bool|string $filter) deprecated

Copies the many_many and belongs_many_many relations from one object to another instance of the name of object.

protected
duplicateManyManyRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single many_many relation from one object to another.

protected
duplicateHasManyRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single many_many relation from one object to another.

protected
duplicateHasOneRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single has_one relation from one object to another.

protected
duplicateBelongsToRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single belongs_to relation from one object to another.

public
string
getObsoleteClassName()

Return obsolete class name, if this is no longer a valid class

public
string
getClassName()

Gets name of this class

public
$this
setClassName(string $className)

Set the ClassName attribute. $class is also updated.

public
newClassInstance(string $newClassName)

Create a new instance of a different class from this object's record.

public
bool
isEmpty()

Returns TRUE if all values (other than "ID") are considered empty (by weak boolean comparison).

public
string
i18n_pluralise(string $count)

Pluralise this item given a specific count.

public
string
singular_name()

Default singular name for page / sitetree

from  SiteTree
public
string
i18n_singular_name()

Get the translated user friendly singular name of this DataObject same as singular_name() but runs it through the translating function

public
string
plural_name()

Default plural name for page / sitetree

from  SiteTree
public
string
i18n_plural_name()

Get the translated user friendly plural name of this DataObject Same as plural_name but runs it through the translation function Translation string is in the form: $this->class.PLURALNAME Example: Page.PLURALNAME

public
string
getTitle()

Standard implementation of a title/label for a specific record. Tries to find properties 'Title' or 'Name', and falls back to the 'ID'. Useful to provide user-friendly identification of a record, e.g. in errormessages or UI-selections.

public
data()

Returns the associated database record - in this case, the object itself.

public
array
toMap()

Convert this object to a map.

public
array
getQueriedDatabaseFields()

Return all currently fetched database fields.

public
update(array $data)

Update a number of fields on this object, given a map of the desired changes.

public
castedUpdate(array $data)

Pass changes as a map, and try to get automatic casting for these fields.

public
bool
merge(DataObject $rightObj, string $priority = 'right', bool $includeRelations = true, bool $overwriteWithEmpty = false)

Merges data and relations from another object of same class, without conflict resolution. Allows to specify which dataset takes priority in case its not empty.

public
$this
forceChange()

Forces the record to think that all its data has changed.

public
validate()

Validate the current object.

from  SiteTree
public
doValidate() deprecated

Public accessor for {DataObject::validate()}

protected
onBeforeWrite()

Event handler called before writing to the database.

from  SiteTree
protected
onAfterWrite()

Event handler called after writing to the database.

public
findCascadeDeletes(bool $recursive = true, ArrayList $list = null)

Find all objects that will be cascade deleted if this object is deleted

public
onBeforeDelete()

Event handler called before deleting from the database.

from  SiteTree
public
onAfterDelete()

No description

from  SiteTree
public
populateDefaults()

Load the default values in from the self::$defaults array.

protected
validateWrite()

Determine validation of this object prior to write

protected
preWrite()

Prepare an object prior to write

protected
bool
updateChanges(bool $forceChanges = false)

Detects and updates all changes made to this object

protected
prepareManipulationTable(string $baseTable, string $now, bool $isNewRecord, array $manipulation, string $class)

Writes a subset of changes for a specific table to the given manipulation

protected
writeBaseRecord(string $baseTable, string $now)

Ensures that a blank base record exists with the basic fixed fields for this dataobject

protected
writeManipulation(string $baseTable, string $now, bool $isNewRecord)

Generate and write the database manipulation for all changed fields

public
write(bool $showDebug = false, bool $forceInsert = false, bool $forceWrite = false, bool|array $writeComponents = false)

Writes all changes to this object to the database.

public
writeRelations()

Writes cached relation lists to the database, if possible

public
writeComponents(bool $recursive = false, array $skip = [])

Write the cached components to the database. Cached components could refer to two different instances of the same record.

public
delete()

Delete this data object.

public static 
delete_by_id(string $className, int $id)

Delete the record with the given ID.

public
array
getClassAncestry()

Get the class ancestry, including the current class name.

public
getComponent(string $componentName)

Return a unary component object from a one to one relationship, as a DataObject.

public
$this
setComponent(string $componentName, DataObject|null $item)

Assign an item to the given component

public
getComponents(string $componentName, int|array $id = null)

Returns a one-to-many relation as a HasManyList

public
string
getRelationClass(string $relationName)

Find the foreign class of a relation on this DataObject, regardless of the relation type.

public
string
getRelationType(string $component)

Given a relation name, determine the relation type

public
inferReciprocalComponent(string $remoteClass, string $remoteRelation)

Given a relation declared on a remote class, generate a substitute component for the opposite side of the relation.

public
getManyManyComponents(string $componentName, int|array $id = null)

Returns a many-to-many component, as a ManyManyList.

public
string|array
hasOne()

Return the class of a one-to-one component. If $component is null, return all of the one-to-one components and their classes. If the selected has_one is a polymorphic field then 'DataObject' will be returned for the type.

public
string|array
belongsTo(bool $classOnly = true)

Returns the class of a remote belongs_to relationship. If no component is specified a map of all components and their class name will be returned.

public
string|array|false
hasMany(bool $classOnly = true)

Gets the class of a one-to-many relationship. If no $component is specified then an array of all the one-to-many relationships and their classes will be returned.

public
array|null
manyManyExtraFields()

Return the many-to-many extra fields specification.

public
array|null
manyMany()

Return information about a many-to-many component.

public
array|false
database_extensions(string $class)

This returns an array (if it exists) describing the database extensions that are required, or false if none

public
getDefaultSearchContext()

Generates a SearchContext to be used for building and processing a generic search form for properties on this object.

public
string
getGeneralSearchFieldName()

Name of the field which is used as a stand-in for searching across all searchable fields.

public
scaffoldSearchFields(array $_params = null)

Determine which properties on the DataObject are searchable, and map them to their default FormField representations. Used for scaffolding a searchform for ModelAdmin.

public
scaffoldFormFields(array $_params = null)

Scaffold a simple edit form for all properties on this dataobject, based on default FormField} mapping in {@link DBField::scaffoldFormField().

protected
beforeUpdateCMSFields(callable $callback)

Allows user code to hook into DataObject::getCMSFields prior to updateCMSFields being called on extensions

protected
afterUpdateCMSFields(callable $callback)

Allows user code to hook into DataObject::getCMSFields after updateCMSFields being called on extensions

public
getCMSFields()

Returns a FieldList with which to create the main editing form.

public
getCMSActions()

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

from  SiteTree
public
getCMSCompositeValidator()

When extending this class and overriding this method, you will need to instantiate the CompositeValidator by calling parent::getCMSCompositeValidator(). This will ensure that the appropriate extension point is also invoked.

public
getFrontEndFields(array $params = null)

Used for simple frontend forms without relation editing or TabSet} behaviour. Uses {@link scaffoldFormFields() by default. To customize, either overload this method in your subclass, or extend it by DataExtension->updateFrontEndFields().

protected
bool
loadLazyFields(string $class = null)

Loads all the stub fields that an initial lazy load didn't load fully.

public
array
getChangedFields(bool|array $databaseFieldsOnly = false, int $changeLevel = self::CHANGE_STRICT)

Return the fields that have changed since the last write.

public
bool
isChanged(string $fieldName = null, int $changeLevel = self::CHANGE_STRICT)

Uses getChangedFields() to determine if fields have been changed since loading them from the database.

public
$this
setCastedField(string $fieldName, mixed $value)

Set the value of the field, using a casting object.

public
bool
hasDatabaseField(string $field)

Returns true if the given field exists as a database column

public
bool
can(string $perm, Member $member = null, array $context = [])

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

from  SiteTree
public
bool|null
extendedCan(string $methodName, Member|int $member, array $context = [])

Process tri-state responses from permission-alterting extensions. The extensions are expected to return one of three values:

public
bool
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.

from  SiteTree
public
bool
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.

from  SiteTree
public
bool
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.

from  SiteTree
public
bool
canCreate(Member $member = null, array $context = [])

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

from  SiteTree
public
string
debug()

Debugging used by Debug::show()

public
dbObject(string $fieldName)

Return the DBField object that represents the given field.

public
mixed
relObject(string $fieldPath)

Traverses to a DBField referenced by relationships between data objects.

public
mixed
relField(string $fieldName)

Traverses to a field referenced by relationships between data objects, returning the value The path to the related field is specified with dot separated syntax (eg: Parent.Child.Child.FieldName)

public
string
getReverseAssociation(string $className)

Temporary hack to return an association name, based on class, to get around the mangle of having to deal with reverse lookup of relationships to determine autogenerated foreign keys.

public static 
get(string $callerClass = null, string|array $filter = "", string|array $sort = "", string $join = "", string|array $limit = null, string $containerClass = DataList::class)

Return all objects matching the filter sub-classes are automatically selected and included

public static 
DataObject|null
get_one(string $callerClass, string|array $filter = "", bool $cache = true, string $orderby = "")

Return the first item matching the given query.

public
flushCache(bool $persistent = true)

Flush the cached results for all relations (has_one, has_many, many_many) Also clears any cached aggregate data.

from  SiteTree
public static 
flush_and_destroy_cache()

Flush the get_one global cache and destroy associated objects.

public static 
reset()

Clear the permissions cache for SiteTree

from  SiteTree
public static 
DataObject|null
get_by_id(string|int $classOrID, int|bool $idOrCache = null, bool $cache = true)

Return the given element, searching by ID.

public
string
baseTable()

Get the name of the base table for this object

public
string
baseClass()

Get the base class for this object

public
array
getSourceQueryParams()

No description

public
array
getInheritableQueryParams()

Get list of parameters that should be inherited to relations on this object

public
setSourceQueryParams(array $array)

No description

public
setSourceQueryParam(string $key, string $value)

No description

public
string
getSourceQueryParam(string $key)

No description

public
requireTable()

Check the database schema and update it as necessary.

public
requireDefaultRecords()

Add default records to database.

from  SiteTree
public
onAfterBuild()

Invoked after every database build is complete (including after table creation and default record population).

public
array
searchableFields()

Get the default searchable fields for this object, as defined in the $searchable_fields list. If searchable fields are not defined on the data object, uses a default selection of summary fields.

public
array
fieldLabels(bool $includerelations = true)

No description

from  SiteTree
public
string
fieldLabel(string $name)

Get a human-readable label for a single field, see fieldLabels() for more details.

public
array
summaryFields()

Get the default summary fields for this object.

public
array
defaultSearchFilters()

Defines a default list of filters for the search context.

public
bool
isInDB()

No description

public static 
disable_subclass_access()

Temporarily disable subclass access in data object qeur

public static 
enable_subclass_access()

No description

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.

from  SiteTree
public
getJoin()

If selected through a many_many through relation, this is the instance of the joined record

public
$this
setJoin(DataObject $object, string $alias = null)

Set joining object

public
findRelatedObjects(string $source, bool $recursive = true, ArrayList $list = null)

Find objects in the given relationships, merging them into the given list

public
mergeRelatedObjects(ArrayList $list, mixed $items)

Helper method to merge owned/owning items into a list.

public
string
getUniqueKey()

Generate a unique key for data object the unique key uses the DataObject::getUniqueKeyComponents() extension point so unique key modifiers such as versioned or fluent are covered i.e. same data object in different stages or different locales will produce different unique key

protected
mergeRelatedObject(ArrayList $list, ArrayList $added, DataObject $item)

Merge single object into a list, but ensures that existing objects are not re-added.

public static 
SiteTree|null
get_by_link(string $link, bool $cache = true)

Fetches the SiteTree object that maps to a link.

from  SiteTree
public static 
array
page_type_classes()

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

from  SiteTree
public static 
string
link_shortcode_handler(array $arguments, string $content = null, ShortcodeParser $parser = null)

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

from  SiteTree
public
string
Link(string $action = null)

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

from  SiteTree
public
string
AbsoluteLink(string $action = null)

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

from  SiteTree
public
string
PreviewLink(string $action = null)

Base link used for previewing. Defaults to absolute URL, in order to account for domain changes, e.g. on multi site setups. Does not contain hints about the stage, see SilverStripeNavigator for details.

from  SiteTree
public
string
getMimeType()

To determine preview mechanism (e.g. embedded / iframe)

from  SiteTree
public
string
RelativeLink(string $action = null)

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

from  SiteTree
public
string
getAbsoluteLiveLink(bool $includeStageEqualsLive = true)

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

from  SiteTree
public
string
CMSEditLink()

Generates a link to edit this page in the CMS.

from  SiteTree
public
string
ElementName()

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

from  SiteTree
public
bool
isCurrent()

Returns true if this is the currently active page being used to handle this request.

from  SiteTree
public
bool
isSection()

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

from  SiteTree
public
bool
isOrphaned()

Check if the parent of this page has been removed (or made otherwise unavailable), and is still referenced by this child. Any such orphaned page may still require access via the CMS, but should not be shown as accessible to external users.

from  SiteTree
public
string
LinkOrCurrent()

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

from  SiteTree
public
string
LinkOrSection()

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

from  SiteTree
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.

from  SiteTree
public
bool
InSection(string $sectionName)

Check if this page is in the given current section.

from  SiteTree
public
onBeforeDuplicate(SiteTree $original, bool $doWrite)

Reset Sort on duped page

from  SiteTree
public
duplicateWithChildren()

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

from  SiteTree
public
duplicateAsChild(int $id)

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

from  SiteTree
public
string
Breadcrumbs(int $maxDepth = 20, bool $unlinked = false, bool|string $stopAtPageType = false, bool $showHidden = false, string $delimiter = '»')

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

from  SiteTree
public
getBreadcrumbItems(int $maxDepth = 20, bool|string $stopAtPageType = false, bool $showHidden = false)

Returns a list of breadcrumbs for the current page.

from  SiteTree
public
setParent(SiteTree|int $item)

Make this page a child of another page.

from  SiteTree
public
getParent()

Get the parent of this page.

from  SiteTree
public
$this
setCreatableChildrenCache(CacheInterface $cache)

No description

from  SiteTree
public
CacheInterface
getCreatableChildrenCache()

No description

from  SiteTree
public
string
NestedTitle(int $level = 2, string $separator = " - ")

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

from  SiteTree
public
bool
canAddChildren(Member|int $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.

from  SiteTree
public
bool
canPublish(Member $member = null)

Check if this page can be published

from  SiteTree
public
getSiteConfig()

Stub method to get the site config, unless the current class can provide an alternate.

from  SiteTree
public static 
getPermissionChecker()

No description

from  SiteTree
public
bool
collateDescendants(string $condition, array $collator)

Collate selected descendants of this page.

from  SiteTree
public
array
MetaComponents()

Return attributes for various meta tags, plus a title tag, in a keyed array.

from  SiteTree
public
getVersionProvider()

No description

from  SiteTree
public
void
setVersionProvider(VersionProvider $versionProvider)

No description

from  SiteTree
public
string
MetaTags(bool $includeTitle = true)

Return the title, description, keywords and language metatags.

from  SiteTree
public
$this
ContentSource()

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

from  SiteTree
public
syncLinkTracking()

Trigger synchronisation of link tracking

from  SiteTree
public
flushMemberCache(array $memberIDs = null)

Flushes the member specific cache for creatable children

from  SiteTree
public
bool
validURLSegment()

Returns true if this object has a URLSegment value that does not conflict with any other objects. This method 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

from  SiteTree
public
string
generateURLSegment(string $title)

Generate a URL segment based on the title provided.

from  SiteTree
public
string
getStageURLSegment()

Gets the URL segment for the latest draft version of this page.

from  SiteTree
public
string
getLiveURLSegment()

Gets the URL segment for the currently published version of this page.

from  SiteTree
public
BackLinkTracking()

Get the back-link tracking objects that link to this page

from  SiteTree
public
DependentPages(bool $includeVirtuals = true)

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

from  SiteTree
public
VirtualPages()

Return all virtual pages that link to this page.

from  SiteTree
public
getSettingsFields()

Returns fields related to configuration aspects on this record, e.g. access control. See getCMSFields() for content-related fields.

from  SiteTree
public
onAfterPublish()

No description

from  SiteTree
public
onAfterRevertToLive()

Update draft dependant pages

from  SiteTree
protected
bool
isParentArchived()

Determine if this page references a parent which is archived, and not available in stage

from  SiteTree
public
doRestoreToStage()

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

from  SiteTree
public
bool
isNew()

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

from  SiteTree
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 dropdown as a Map from class name to singular name. Filters by SiteTree->canCreate(), as well as SiteTree::$needs_permission.

from  SiteTree
public
string[]
allowedChildren()

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

from  SiteTree
public
array
creatableChildren() deprecated

No description

from  SiteTree
public
array
creatableChildPages()

Gets a list of the page types that can be created under this specific page, including font icons

from  SiteTree
public
string
defaultChild()

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

from  SiteTree
public
string
defaultParent()

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

from  SiteTree
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.

from  SiteTree
public
setMenuTitle(string $value)

Set the menu title for this page.

from  SiteTree
public
array
getStatusFlags(bool $cached = true)

A flag provides the user with additional data about the current page status, for example a "removed from draft" status. Each page can have more than one status flag. Returns a map of a unique key to a (localized) title for the flag. The unique key can be reused as a CSS class. Use the 'updateStatusFlags' extension point to customize the flags.

from  SiteTree
public
string
getIconClass()

Returns the CSS class used for the page icon in the site tree.

from  SiteTree
public
string
getTreeTitle()

getTreeTitle will return three html DOM elements, an empty with the class 'jstree-pageicon' in front, following by a wrapping around its MenuTitle, then following by a indicating its publication status.

from  SiteTree
public
Level(int $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.

from  SiteTree
public
int
getPageLevel()

Gets the depth of this page in the sitetree, where 1 is the root level

from  SiteTree
public
string
getControllerName()

Find the controller name by our convention of {$ModelClass}Controller Can be overriden by config variable

from  SiteTree
public
string
CMSTreeClasses()

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

from  SiteTree
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 extension. Call before calling parent::getCMSFields(), and reenable afterwards.

from  SiteTree
public static 
enableCMSFieldsExtensions()

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

from  SiteTree
public
providePermissions()

Return a map of permission codes to add to the dropdown shown in the Security section of the CMS.

from  SiteTree
public
string
getPageIconURL()

Generate link to this page's icon

from  SiteTree
public
string|null
classDescription()

Get description for this page type

from  SiteTree
public
string|null
i18n_classDescription()

Get localised description for this page

from  SiteTree
public
string
getParentType()

Returns 'root' if the current page has no parent, or 'subpage' otherwise

from  SiteTree
public static 
flush()

Clear the creatableChildren cache on flush

from  SiteTree
protected
updateDependentPages()

Update dependant pages

from  SiteTree
protected
string
generateChildrenCacheKey(int $memberID)

Cache key for creatableChildren() method

from  SiteTree
protected
array
getExcludedURLSegments()

Get the list of excluded root URL segments

from  SiteTree
public
array
getAnchorsOnPage()

No description

from  SiteTree
public
bool
isHomePage()

Returns whether this is the home page or not

from  SiteTree
ViewerGroups()

List of groups that can view this object.

from  SiteTree
EditorGroups()

List of groups that can edit this object.

from  SiteTree
Parent()

No description

from  SiteTree
SiteTreeLink[]
BackLinks()

List of SiteTreeLink objects attached to this page

from  SiteTree
public
getFooter()

Get the footer holder.

public
RelatedPages()

No description

public
RelatedPagesTitle()

No description

public
string
getSelectedLanguage()

Returns the native language name for the selected locale/language, empty string if Fluent is not available

Details

mixed __call(string $method, array $arguments)

Attempts to locate and call a method dynamically added to a class at runtime if a default cannot be located

You can add extra methods to a class using Extensions}, {@link Object::createMethod() or Object::addWrapperMethod()

Parameters

string $method
array $arguments

Return Value

mixed

Exceptions

BadMethodCallException

protected defineMethods()

Adds any methods from Extension instances attached to this object.

All these methods can then be called directly on the instance (transparently mapped through __call()}), or called explicitly through {@link extend().

protected registerExtraMethodCallback(string $name, callable $callback)

Register an callback to invoke that defines extra methods

Parameters

string $name
callable $callback

bool hasMethod(string $method)

Return TRUE if a method exists on this object

This should be used rather than PHP's inbuild method_exists() as it takes into account methods added via extensions

Parameters

string $method

Return Value

bool

protected array getExtraMethodConfig(string $method)

Get meta-data details on a named method

Parameters

string $method

Return Value

array

List of custom method details, if defined for this method

array allMethodNames(bool $custom = false)

Return the names of all the methods available on this object

Parameters

bool $custom

include methods added dynamically at runtime

Return Value

array

protected array findMethodsFromExtension(object $extension) deprecated

deprecated 4.13.0 Will be replaced by findMethodsFrom() in CMS 5

No description

Parameters

object $extension

Return Value

array

protected addMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an Extension) to this object.

Parameters

string $property

the property name

string|int $index

an index to use if the property is an array

Exceptions

InvalidArgumentException

protected removeMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an Extension) to this object.

Parameters

string $property

the property name

string|int $index

an index to use if the property is an array

protected addWrapperMethod(string $method, string $wrap)

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

Parameters

string $method

the method name to wrap

string $wrap

the method name to wrap to

protected addCallbackMethod(string $method, callable $callback)

Add callback as a method.

Parameters

string $method

Name of method

callable $callback

Callback to invoke. Note: $this is passed as first parameter to this callback and then $args as array

protected beforeExtending(string $method, callable $callback)

Allows user code to hook into Object::extend prior to control being delegated to extensions. Each callback will be reset once called.

Parameters

string $method

The name of the method to hook into

callable $callback

The callback to execute

protected afterExtending(string $method, callable $callback)

Allows user code to hook into Object::extend after control being delegated to extensions. Each callback will be reset once called.

Parameters

string $method

The name of the method to hook into

callable $callback

The callback to execute

protected constructExtensions() deprecated

deprecated 4.0.0:5.0.0 Extensions and methods are now lazy-loaded

No description

protected defineExtensionMethods()

Adds any methods from Extension instances attached to this object.

All these methods can then be called directly on the instance (transparently mapped through __call()}), or called explicitly through {@link extend().

static bool add_extension(string $classOrExtension, string $extension = null)

Add an extension to a specific class.

The preferred method for adding extensions is through YAML config, since it avoids autoloading the class, and is easier to override in more specific configurations.

As an alternative, extensions can be added to a specific class directly in the Object::$extensions array. See SiteTree::$extensions for examples. Keep in mind that the extension will only be applied to new instances, not existing ones (including all instances created through singleton()).

Parameters

string $classOrExtension

Class that should be extended - has to be a subclass of Object

string $extension

Subclass of Extension with optional parameters as a string, e.g. "Versioned" or "Translatable('Param')"

Return Value

bool

Flag if the extension was added

See also

http://doc.silverstripe.org/framework/en/trunk/reference/dataextension

static remove_extension(string $extension)

Remove an extension from a class.

Note: This will not remove extensions from parent classes, and must be called directly on the class assigned the extension.

Keep in mind that this won't revert any datamodel additions of the extension at runtime, unless its used before the schema building kicks in (in your _config.php). Doesn't remove the extension from any Object instances which are already created, but will have an effect on new extensions. Clears any previously created singletons through singleton() to avoid side-effects from stale extension information.

Add support for removing extensions with parameters

Parameters

string $extension

class name of an Extension subclass, without parameters

static array get_extensions(string $class = null, bool $includeArgumentString = false)

No description

Parameters

string $class

If omitted, will get extensions for the current class

bool $includeArgumentString

Include the argument string in the return array, FALSE would return array("Versioned"), TRUE returns array("Versioned('Stage','Live')").

Return Value

array

Numeric array of either DataExtension class names, or eval'ed class name strings with constructor arguments.

static array|null get_extra_config_sources(string $class = null)

Get extra config sources for this class

Parameters

string $class

Name of class. If left null will return for the current class

Return Value

array|null

static bool has_extension(string $classOrExtension, string $requiredExtension = null, bool $strict = false)

Return TRUE if a class has a specified extension.

This supports backwards-compatible format (static Object::has_extension($requiredExtension)) and new format ($object->has_extension($class, $requiredExtension))

Parameters

string $classOrExtension

Class to check extension for, or the extension name to check if the second argument is null.

string $requiredExtension

If the first argument is the parent class, this is the extension to check. If left null, the first parameter will be treated as the extension.

bool $strict

if the extension has to match the required extension and not be a subclass

Return Value

bool

Flag if the extension exists

array invokeWithExtensions(string $method, mixed $a1 = null, mixed $a2 = null, mixed $a3 = null, mixed $a4 = null, mixed $a5 = null, mixed $a6 = null, mixed $a7 = null)

Calls a method if available on both this object and all applied Extensions, and then attempts to merge all results into an array

Parameters

string $method

the method name to call

mixed $a1
mixed $a2
mixed $a3
mixed $a4
mixed $a5
mixed $a6
mixed $a7

Return Value

array

List of results with nulls filtered out

array extend(string $method, mixed $a1 = null, mixed $a2 = null, mixed $a3 = null, mixed $a4 = null, mixed $a5 = null, mixed $a6 = null, mixed $a7 = null)

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

Currently returns an array, with an index resulting every time the function is called. Only adds returns if they're not NULL, to avoid bogus results from methods just defined on the parent extension. This is important for permission-checks through extend, as they use min() to determine if any of the returns is FALSE. As min() doesn't do type checking, an included NULL return would fail the permission checks.

The extension methods are defined during __construct()} in {@link defineMethods().

Parameters

string $method

the name of the method to call on each extension

mixed $a1
mixed $a2
mixed $a3
mixed $a4
mixed $a5
mixed $a6
mixed $a7

Return Value

array

Extension|null getExtensionInstance(string $extension)

Get an extension instance attached to this object by name.

Parameters

string $extension

Return Value

Extension|null

bool hasExtension(string $extension)

Returns TRUE if this object instance has a specific extension applied in $extension_instances. Extension instances are initialized at constructor time, meaning if you use add_extension() afterwards, the added extension will just be added to new instances of the extended class. Use the static method has_extension() to check if a class (not an instance) has a specific extension.

Caution: Don't use singleton()->hasExtension() as it will give you inconsistent results based on when the singleton was first accessed.

Parameters

string $extension

Classname of an Extension subclass without parameters

Return Value

bool

Extension[] getExtensionInstances()

Get all extension instances for this specific object instance.

See get_extensions() to get all applied extension classes for this class (not the instance).

This method also provides lazy-population of the extension_instances property.

Return Value

Extension[]

Map of DataExtension instances, keyed by classname.

static Injectable create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();

Parameters

mixed ...$args

Return Value

Injectable

static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class

Optional classname to create, if the called class should not be used

Return Value

Injectable

The singleton instance

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

__construct(array $record = [], int|bool $creationType = self::CREATE_OBJECT, array $queryParams = [])

Construct a new DataObject.

Parameters

array $record

Initial record content, or rehydrated record content, depending on $creationType

int|bool $creationType

Set to DataObject::CREATE_OBJECT, DataObject::CREATE_HYDRATED, DataObject::CREATE_MEMORY_HYDRATED or DataObject::CREATE_SINGLETON. Used by Silverstripe internals and best left as the default by regular users.

array $queryParams

List of DataQuery params necessary to lazy load, or load related objects.

bool __isset(string $property)

Check if a field exists on this object or its failover.

Note that, unlike the core isset() implementation, this will return true if the property is defined and set to null.

Parameters

string $property

Return Value

bool

mixed __get(string $property)

Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using ViewableData::getField(), then fall back on a failover object.

Parameters

string $property

Return Value

mixed

__set(string $property, mixed $value)

Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the ViewableData::setField() method.

Parameters

string $property
mixed $value

setFailover(ViewableData $failover)

Set a failover object to attempt to get data from if it is not present on this object.

Parameters

ViewableData $failover

ViewableData|null getFailover()

Get the current failover object if set

Return Value

ViewableData|null

bool hasField(string $field)

Returns true if the given field exists in a database column on any of the objects tables and optionally look up a dynamic getter with get().

Parameters

string $field

Return Value

bool

mixed getField(string $field)

Gets the value of a field.

Called by __get() and any getFieldName() methods you might create.

Parameters

string $field

Return Value

mixed

$this setField(string $fieldName, mixed $val)

Set the value of the field Called by __set() and any setFieldName() methods you might create.

Parameters

string $fieldName

Name of the field

mixed $val

New field value

Return Value

$this

ViewableData_Customised customise(array|ViewableData $data)

Merge some arbitrary data in with this object. This method returns a ViewableData_Customised instance with references to both this and the new custom data.

Note that any fields you specify will take precedence over the fields on this object.

Parameters

array|ViewableData $data

Return Value

ViewableData_Customised

bool exists()

Returns true if this object "exists", i.e., has a sensible value.

The default behaviour for a DataObject is to return true if the object exists in the database, you can override this in subclasses.

Return Value

bool

string __toString()

No description

Return Value

string

the class name

ViewableData getCustomisedObj()

No description

Return Value

ViewableData

setCustomisedObj(ViewableData $object)

No description

Parameters

ViewableData $object

string castingHelper(string $field)

Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. This helper will be a subclass of DBField.

Parameters

string $field

Return Value

string

Casting helper As a constructor pattern, and may include arguments.

Exceptions

Exception

string castingClass(string $field)

Get the class name a field on this object will be casted to.

Parameters

string $field

Return Value

string

string escapeTypeForField(string $field)

Return the string-format type for the given field.

Parameters

string $field

Return Value

string 'xml'|'raw'

DBHTMLText renderWith(string|array|SSViewer $template, array $customFields = null)

Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter:

  • a template name (e.g. Page)
  • an array of possible template names - the first valid one will be used
  • an SSViewer instance

Parameters

string|array|SSViewer $template

the template to render into

array $customFields

fields to customise() the object with before rendering

Return Value

DBHTMLText

protected string objCacheName(string $fieldName, array $arguments)

Generate the cache name for a field

Parameters

string $fieldName

Name of field

array $arguments

List of optional arguments given

Return Value

string

protected mixed objCacheGet(string $key)

Get a cached value from the field cache

Parameters

string $key

Cache key

Return Value

mixed

protected $this objCacheSet(string $key, mixed $value)

Store a value in the field cache

Parameters

string $key

Cache key

mixed $value

Return Value

$this

protected $this objCacheClear()

Clear object cache

Return Value

$this

object|DBField obj(string $fieldName, array $arguments = [], bool $cache = false, string $cacheName = null)

Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified.

Parameters

string $fieldName
array $arguments
bool $cache

Cache this object

string $cacheName

a custom cache name

Return Value

object|DBField

object|DBField cachedCall(string $field, array $arguments = [], string $identifier = null)

A simple wrapper around ViewableData::obj() that automatically caches the result so it can be used again without re-running the method.

Parameters

string $field
array $arguments
string $identifier

an optional custom cache identifier

Return Value

object|DBField

bool hasValue(string $field, array $arguments = null, bool $cache = true)

Returns true if the given method/parameter has a value (Uses the DBField::hasValue if the parameter is a database field)

Parameters

string $field
array $arguments
bool $cache

Return Value

bool

string XML_val(string $field, array $arguments = [], bool $cache = false)

Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template.

Parameters

string $field
array $arguments
bool $cache

Return Value

string

array getXMLValues(array $fields)

Get an array of XML-escaped values by field name

Parameters

array $fields

an array of field names

Return Value

array

ArrayIterator getIterator()

Return a single-item iterator so you can iterate over the fields of a single record.

This is useful so you can use a single record inside a <% control %> block in a template - and then use to access individual fields on this object.

Return Value

ArrayIterator

array getViewerTemplates(string $suffix = '')

Find appropriate templates for SSViewer to use to render this object

Parameters

string $suffix

Return Value

array

ViewableData Me()

When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself.

Return Value

ViewableData

string ThemeDir() deprecated

deprecated 4.0.1 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead

Return the directory if the current active theme (relative to the site root).

This method is useful for things such as accessing theme images from your template without hardcoding the theme page - e.g. .

This method should only be used when a theme is currently active. However, it will fall over to the current project directory.

Return Value

string

URL to the current theme

string CSSClasses(string $stopAtClass = self::class)

Get part of the current classes ancestry to be used as a CSS class.

This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a stop point - e.g. "Page DataObject ViewableData".

Parameters

string $stopAtClass

the class to stop at (default: ViewableData)

Return Value

string

ViewableData_Debugger Debug()

Return debug information about this object that can be rendered into a template

Return Value

ViewableData_Debugger

static DataObjectSchema getSchema()

Get schema object

Return Value

DataObjectSchema

destroy()

Destroy all of this objects dependent objects and local caches.

You'll need to call this to get the memory of an object that has components or extensions freed.

DataObject duplicate(bool $doWrite = true, array|null|false $relations = null)

Create a duplicate of this node. Can duplicate many_many relations

Parameters

bool $doWrite

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

array|null|false $relations

List of relations to duplicate. Will default to cascade_duplicates if null. Set to 'false' to force none. Set to specific array of names to duplicate to override these. Note: If using versioned, this will additionally failover to owns config.

Return Value

DataObject

A duplicate of this node. The exact type will be the type of this node.

protected duplicateRelations(DataObject $sourceObject, DataObject $destinationObject, array $relations)

Copies the given relations from this object to the destination

Parameters

DataObject $sourceObject

the source object to duplicate from

DataObject $destinationObject

the destination object to populate with the duplicated relations

array $relations

List of relations

protected duplicateManyManyRelations(DataObject $sourceObject, DataObject $destinationObject, bool|string $filter) deprecated

deprecated 4.1.0 Use duplicateRelations() instead

Copies the many_many and belongs_many_many relations from one object to another instance of the name of object.

Parameters

DataObject $sourceObject

the source object to duplicate from

DataObject $destinationObject

the destination object to populate with the duplicated relations

bool|string $filter

protected duplicateManyManyRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single many_many relation from one object to another.

Parameters

DataObject $sourceObject
DataObject $destinationObject
string $relation

protected duplicateHasManyRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single many_many relation from one object to another.

Parameters

DataObject $sourceObject
DataObject $destinationObject
string $relation

protected duplicateHasOneRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single has_one relation from one object to another.

Note: Child object will be force written.

Parameters

DataObject $sourceObject
DataObject $destinationObject
string $relation

protected duplicateBelongsToRelation(DataObject $sourceObject, DataObject $destinationObject, string $relation)

Duplicates a single belongs_to relation from one object to another.

Note: This will force a write on both parent / child objects.

Parameters

DataObject $sourceObject
DataObject $destinationObject
string $relation

string getObsoleteClassName()

Return obsolete class name, if this is no longer a valid class

Return Value

string

string getClassName()

Gets name of this class

Return Value

string

$this setClassName(string $className)

Set the ClassName attribute. $class is also updated.

Warning: This will produce an inconsistent record, as the object instance will not automatically switch to the new subclass. Please use newClassInstance() for this purpose, or destroy and reinstanciate the record.

Parameters

string $className

The new ClassName attribute (a subclass of DataObject)

Return Value

$this

DataObject newClassInstance(string $newClassName)

Create a new instance of a different class from this object's record.

This is useful when dynamically changing the type of an instance. Specifically, it ensures that the instance of the class is a match for the className of the record. Don't set the DataObject->class} or {@link DataObject->ClassName property manually before calling this method, as it will confuse change detection.

If the new class is different to the original class, defaults are populated again because this will only occur automatically on instantiation of a DataObject if there is no record, or the record has no ID. In this case, we do have an ID but we still need to repopulate the defaults.

Parameters

string $newClassName

The name of the new class

Return Value

DataObject

The new instance of the new class, The exact type will be of the class name provided.

bool isEmpty()

Returns TRUE if all values (other than "ID") are considered empty (by weak boolean comparison).

Return Value

bool

string i18n_pluralise(string $count)

Pluralise this item given a specific count.

E.g. "0 Pages", "1 File", "3 Images"

Parameters

string $count

Return Value

string

string singular_name()

Default singular name for page / sitetree

Return Value

string

User friendly singular name of this DataObject

string i18n_singular_name()

Get the translated user friendly singular name of this DataObject same as singular_name() but runs it through the translating function

Translating string is in the form: $this->class.SINGULARNAME Example: Page.SINGULARNAME

Return Value

string

User friendly translated singular name of this DataObject

string plural_name()

Default plural name for page / sitetree

Return Value

string

User friendly plural name of this DataObject

string i18n_plural_name()

Get the translated user friendly plural name of this DataObject Same as plural_name but runs it through the translation function Translation string is in the form: $this->class.PLURALNAME Example: Page.PLURALNAME

Return Value

string

User friendly translated plural name of this DataObject

string getTitle()

Standard implementation of a title/label for a specific record. Tries to find properties 'Title' or 'Name', and falls back to the 'ID'. Useful to provide user-friendly identification of a record, e.g. in errormessages or UI-selections.

Overload this method to have a more specialized implementation, e.g. for an Address record this could be:

function getTitle() {
  return "{$this->StreetNumber} {$this->StreetName} {$this->City}";
}

Return Value

string

DataObject data()

Returns the associated database record - in this case, the object itself.

This is included so that you can call $dataOrController->data() and get a DataObject all the time.

Return Value

DataObject

Associated database record

array toMap()

Convert this object to a map.

Note that it has the following quirks:

  • custom getters, including those that adjust the result of database fields, won't be executed
  • NULL values won't be returned.

Return Value

array

The data as a map.

array getQueriedDatabaseFields()

Return all currently fetched database fields.

This function is similar to toMap() but doesn't trigger the lazy-loading of all unfetched fields. Obviously, this makes it a lot faster.

Return Value

array

The data as a map.

DataObject update(array $data)

Update a number of fields on this object, given a map of the desired changes.

The field names can be simple names, or you can use a dot syntax to access $has_one relations. For example, array("Author.FirstName" => "Jim") will set $this->Author()->FirstName to "Jim".

Doesn't write the main object, but if you use the dot syntax, it will write() the related objects that it alters.

When using this method with user supplied data, it's very important to whitelist the allowed keys.

Parameters

array $data

A map of field name to data values to update.

Return Value

DataObject $this

DataObject castedUpdate(array $data)

Pass changes as a map, and try to get automatic casting for these fields.

Doesn't write to the database. To write the data, use the write() method.

Parameters

array $data

A map of field name to data values to update.

Return Value

DataObject $this

bool merge(DataObject $rightObj, string $priority = 'right', bool $includeRelations = true, bool $overwriteWithEmpty = false)

Merges data and relations from another object of same class, without conflict resolution. Allows to specify which dataset takes priority in case its not empty.

has_one-relations are just transferred with priority 'right'. has_many and many_many-relations are added regardless of priority.

Caution: has_many/many_many relations are moved rather than duplicated, meaning they are not connected to the merged object any longer. Caution: Just saves updated has_many/many_many relations to the database, doesn't write the updated object itself (just writes the object-properties). Caution: Does not delete the merged object. Caution: Does now overwrite Created date on the original object.

Parameters

DataObject $rightObj
string $priority

left|right Determines who wins in case of a conflict (optional)

bool $includeRelations

Merge any existing relations (optional)

bool $overwriteWithEmpty

Overwrite existing left values with empty right values. Only applicable with $priority='right'. (optional)

Return Value

bool

$this forceChange()

Forces the record to think that all its data has changed.

Doesn't write to the database. Force-change preserved until next write. Existing CHANGE_VALUE or CHANGE_STRICT values are preserved.

Return Value

$this

ValidationResult validate()

Validate the current object.

By default, there is no validation - objects are always valid! However, you can overload this method in your DataObject sub-classes to specify custom validation, or use the hook through DataExtension.

Invalid objects won't be able to be written - a warning will be thrown and no write will occur. onBeforeWrite() and onAfterWrite() won't get called either.

It is expected that you call validate() in your own application to test that an object is valid before attempting a write, and respond appropriately if it isn't.

Return Value

ValidationResult

ValidationResult doValidate() deprecated

deprecated 4.12.0 Use validate() instead

Public accessor for {DataObject::validate()}

Return Value

ValidationResult

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!

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

protected 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!

ArrayList findCascadeDeletes(bool $recursive = true, ArrayList $list = null)

Find all objects that will be cascade deleted if this object is deleted

Notes:

  • If this object is versioned, objects will only be searched in the same stage as the given record.
  • This will only be useful prior to deletion, as post-deletion this record will no longer exist.

Parameters

bool $recursive

True if recursive

ArrayList $list

Optional list to add items to

Return Value

ArrayList

list of objects

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!

onAfterDelete()

No description

DataObject populateDefaults()

Load the default values in from the self::$defaults array.

Will traverse the defaults of the current class and all its parent classes. Called by the constructor when creating new records.

Return Value

DataObject $this

protected ValidationException validateWrite()

Determine validation of this object prior to write

Return Value

ValidationException

Exception generated by this write, or null if valid

protected preWrite()

Prepare an object prior to write

Exceptions

ValidationException

protected bool updateChanges(bool $forceChanges = false)

Detects and updates all changes made to this object

Parameters

bool $forceChanges

If set to true, force all fields to be treated as changed

Return Value

bool

True if any changes are detected

protected prepareManipulationTable(string $baseTable, string $now, bool $isNewRecord, array $manipulation, string $class)

Writes a subset of changes for a specific table to the given manipulation

Parameters

string $baseTable

Base table

string $now

Timestamp to use for the current time

bool $isNewRecord

Whether this should be treated as a new record write

array $manipulation

Manipulation to write to

string $class

Class of table to manipulate

protected writeBaseRecord(string $baseTable, string $now)

Ensures that a blank base record exists with the basic fixed fields for this dataobject

Does nothing if an ID is already assigned for this record

Parameters

string $baseTable

Base table

string $now

Timestamp to use for the current time

protected writeManipulation(string $baseTable, string $now, bool $isNewRecord)

Generate and write the database manipulation for all changed fields

Parameters

string $baseTable

Base table

string $now

Timestamp to use for the current time

bool $isNewRecord

If this is a new record

Exceptions

InvalidArgumentException

write(bool $showDebug = false, bool $forceInsert = false, bool $forceWrite = false, bool|array $writeComponents = false)

Writes all changes to this object to the database.

  • It will insert a record whenever ID isn't set, otherwise update.
  • All relevant tables will be updated.
  • $this->onBeforeWrite() gets called beforehand.
  • Extensions such as Versioned will amend the database-write to ensure that a version is saved.

Parameters

bool $showDebug

Show debugging information

bool $forceInsert

Run INSERT command rather than UPDATE, even if record already exists

bool $forceWrite

Write to database even if there are no changes

bool|array $writeComponents

Call write() on all associated component instances which were previously retrieved through getComponent()}, {@link getComponents() or getManyManyComponents(). Default to false. The parameter can also be provided in the form of an array: ['recursive' => true, skip => ['Page'=>[1,2,3]]. This avoid infinite loops when one DataObject are components of each other.

Exceptions

ValidationException

writeRelations()

Writes cached relation lists to the database, if possible

DataObject writeComponents(bool $recursive = false, array $skip = [])

Write the cached components to the database. Cached components could refer to two different instances of the same record.

Parameters

bool $recursive

Recursively write components

array $skip

List of DataObject references to skip

Return Value

DataObject $this

delete()

Delete this data object.

$this->onBeforeDelete() gets called. Note that in Versioned objects, both Stage and Live will be deleted.

static delete_by_id(string $className, int $id)

Delete the record with the given ID.

Parameters

string $className

The class name of the record to be deleted

int $id

ID of record to be deleted

array getClassAncestry()

Get the class ancestry, including the current class name.

The ancestry will be returned as an array of class names, where the 0th element will be the class that inherits directly from DataObject, and the last element will be the current class.

Return Value

array

Class ancestry

DataObject getComponent(string $componentName)

Return a unary component object from a one to one relationship, as a DataObject.

If no component is available, an 'empty component' will be returned for non-polymorphic relations, or for polymorphic relations with a class set.

Parameters

string $componentName

Name of the component

Return Value

DataObject

The component object. It's exact type will be that of the component.

Exceptions

Exception

$this setComponent(string $componentName, DataObject|null $item)

Assign an item to the given component

Parameters

string $componentName
DataObject|null $item

Return Value

$this

HasManyList|UnsavedRelationList getComponents(string $componentName, int|array $id = null)

Returns a one-to-many relation as a HasManyList

Parameters

string $componentName

Name of the component

int|array $id

Optional ID(s) for parent of this relation, if not the current record

Return Value

HasManyList|UnsavedRelationList

The components of the one-to-many relationship.

string getRelationClass(string $relationName)

Find the foreign class of a relation on this DataObject, regardless of the relation type.

Parameters

string $relationName

Relation name.

Return Value

string

Class name, or null if not found.

string getRelationType(string $component)

Given a relation name, determine the relation type

Parameters

string $component

Name of component

Return Value

string

has_one, has_many, many_many, belongs_many_many or belongs_to

DataList|DataObject inferReciprocalComponent(string $remoteClass, string $remoteRelation)

Given a relation declared on a remote class, generate a substitute component for the opposite side of the relation.

Notes on behaviour:

  • This can still be used on components that are defined on both sides, but do not need to be.
  • All has_ones on remote class will be treated as local has_many, even if they are belongs_to
  • Polymorphic relationships do not have two natural endpoints (only on one side) and thus attempting to infer them will return nothing.
  • Cannot be used on unsaved objects.

Parameters

string $remoteClass
string $remoteRelation

Return Value

DataList|DataObject

The component, either as a list or single object

Exceptions

BadMethodCallException
InvalidArgumentException

ManyManyList|UnsavedRelationList getManyManyComponents(string $componentName, int|array $id = null)

Returns a many-to-many component, as a ManyManyList.

Parameters

string $componentName

Name of the many-many component

int|array $id

Optional ID for parent of this relation, if not the current record

Return Value

ManyManyList|UnsavedRelationList

The set of components

string|array hasOne()

Return the class of a one-to-one component. If $component is null, return all of the one-to-one components and their classes. If the selected has_one is a polymorphic field then 'DataObject' will be returned for the type.

Return Value

string|array

The class of the one-to-one component, or an array of all one-to-one components and their classes.

string|array belongsTo(bool $classOnly = true)

Returns the class of a remote belongs_to relationship. If no component is specified a map of all components and their class name will be returned.

Parameters

bool $classOnly

If this is TRUE, than any has_many relationships in the form "ClassName.Field" will have the field data stripped off. It defaults to TRUE.

Return Value

string|array

string|array|false hasMany(bool $classOnly = true)

Gets the class of a one-to-many relationship. If no $component is specified then an array of all the one-to-many relationships and their classes will be returned.

Parameters

bool $classOnly

If this is TRUE, than any has_many relationships in the form "ClassName.Field" will have the field data stripped off. It defaults to TRUE.

Return Value

string|array|false

array|null manyManyExtraFields()

Return the many-to-many extra fields specification.

If you don't specify a component name, it returns all extra fields for all components available.

Return Value

array|null

array|null manyMany()

Return information about a many-to-many component.

The return value is an array of (parentclass, childclass). If $component is null, then all many-many components are returned.

Return Value

array|null

An array of (parentclass, childclass), or an array of all many-many components

See also

DataObjectSchema::manyManyComponent

array|false database_extensions(string $class)

This returns an array (if it exists) describing the database extensions that are required, or false if none

This is experimental, and is currently only a Postgres-specific enhancement.

Parameters

string $class

Return Value

array|false

SearchContext getDefaultSearchContext()

Generates a SearchContext to be used for building and processing a generic search form for properties on this object.

Return Value

SearchContext

string getGeneralSearchFieldName()

Name of the field which is used as a stand-in for searching across all searchable fields.

If this is a blank string, general search functionality is disabled and the general search field falls back to using the first field in the searchable fields array.

Return Value

string

FieldList scaffoldSearchFields(array $_params = null)

Determine which properties on the DataObject are searchable, and map them to their default FormField representations. Used for scaffolding a searchform for ModelAdmin.

Some additional logic is included for switching field labels, based on how generic or specific the field type is.

Used by SearchContext.

Parameters

array $_params

'fieldClasses': Associative array of field names as keys and FormField classes as values 'restrictFields': Numeric array of a field name whitelist

Return Value

FieldList

FieldList scaffoldFormFields(array $_params = null)

Scaffold a simple edit form for all properties on this dataobject, based on default FormField} mapping in {@link DBField::scaffoldFormField().

Field labels/titles will be auto generated from DataObject::fieldLabels().

Parameters

array $_params

Associative array passing through properties to FormScaffolder.

Return Value

FieldList

protected beforeUpdateCMSFields(callable $callback)

Allows user code to hook into DataObject::getCMSFields prior to updateCMSFields being called on extensions

Parameters

callable $callback

The callback to execute

protected afterUpdateCMSFields(callable $callback)

Allows user code to hook into DataObject::getCMSFields after updateCMSFields being called on extensions

Parameters

callable $callback

The callback to execute

FieldList getCMSFields()

Returns a FieldList with which to create the main 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 FieldList.

See getSettingsFields() for a different set of fields concerned with configuration aspects on the record, e.g. access control.

Return Value

FieldList

Returns a TabSet for usage within the CMS - don't use for frontend forms.

FieldList getCMSActions()

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

Frontend scripts and styles know how to handle the following FormFields:

  • top-level FormActions appear as standalone buttons
  • top-level CompositeField with FormActions within appear as grouped buttons
  • TabSet & Tabs appear as a drop ups
  • FormActions within the Tab are restyled as links
  • major actions can provide alternate states for richer presentation (see ssui.button widget extension)

Return Value

FieldList

an Empty FieldList(); need to be overload by solid subclass

CompositeValidator getCMSCompositeValidator()

When extending this class and overriding this method, you will need to instantiate the CompositeValidator by calling parent::getCMSCompositeValidator(). This will ensure that the appropriate extension point is also invoked.

You can also update the CompositeValidator by creating an Extension and implementing the updateCMSCompositeValidator(CompositeValidator $compositeValidator) method.

Return Value

CompositeValidator

See also

CompositeValidator for examples of implementation

FieldList getFrontEndFields(array $params = null)

Used for simple frontend forms without relation editing or TabSet} behaviour. Uses {@link scaffoldFormFields() by default. To customize, either overload this method in your subclass, or extend it by DataExtension->updateFrontEndFields().

Decide on naming for "website|frontend|site|page" and stick with it in the API

Parameters

array $params

See scaffoldFormFields()

Return Value

FieldList

Always returns a simple field collection without TabSet.

protected bool loadLazyFields(string $class = null)

Loads all the stub fields that an initial lazy load didn't load fully.

Parameters

string $class

Class to load the values from. Others are joined as required. Not specifying a tableClass will load all lazy fields from all tables.

Return Value

bool

Flag if lazy loading succeeded

array getChangedFields(bool|array $databaseFieldsOnly = false, int $changeLevel = self::CHANGE_STRICT)

Return the fields that have changed since the last write.

The change level affects what the functions defines as "changed":

  • Level CHANGE_STRICT (integer 1) will return strict changes, even !== ones.
  • Level CHANGE_VALUE (integer 2) is more lenient, it will only return real data changes, for example a change from 0 to null would not be included.

Example return:

array(
  'Title' = array('before' => 'Home', 'after' => 'Home-Changed', 'level' => DataObject::CHANGE_VALUE)
)

Parameters

bool|array $databaseFieldsOnly

Filter to determine which fields to return. Set to true to return all database fields, or an array for an explicit filter. false returns all fields.

int $changeLevel

The strictness of what is defined as change. Defaults to strict

Return Value

array

bool isChanged(string $fieldName = null, int $changeLevel = self::CHANGE_STRICT)

Uses getChangedFields() to determine if fields have been changed since loading them from the database.

Parameters

string $fieldName

Name of the database field to check, will check for any if not given

int $changeLevel

See getChangedFields()

Return Value

bool

$this setCastedField(string $fieldName, mixed $value)

Set the value of the field, using a casting object.

This is useful when you aren't sure that a date is in SQL format, for example. setCastedField() can also be used, by forms, to set related data. For example, uploaded images can be saved into the Image table.

Parameters

string $fieldName
mixed $value

New field value

Return Value

$this

bool hasDatabaseField(string $field)

Returns true if the given field exists as a database column

Parameters

string $field

Name of the field

Return Value

bool

bool can(string $perm, Member $member = null, array $context = [])

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

Slightly altered from parent behaviour in DataObject->can():

  • Checks for existence of a method named "can<$perm>()" on the object
  • Calls decorators and only returns for FALSE "vetoes"
  • Falls back to Permission::check()
  • Does NOT check for many-many relations named "Can<$perm>"

Parameters

string $perm

The permission to be checked, such as 'View'.

Member $member

The member whose permissions need checking. Defaults to the currently logged in user.

array $context

Additional $context to pass to extendedCan()

Return Value

bool

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

bool|null extendedCan(string $methodName, Member|int $member, array $context = [])

Process tri-state responses from permission-alterting extensions. The extensions are expected to return one of three values:

  • false: Disallow this permission, regardless of what other extensions say
    • true: Allow this permission, as long as no other extensions return false
    • NULL: Don't affect the outcome

This method itself returns a tri-state value, and is designed to be used like this:

$extended = $this->extendedCan('canDoSomething', $member);
if ($extended !== null) return $extended;
else return $normalValue;

Parameters

string $methodName

Method on the same object, e.g. canEdit()

Member|int $member
array $context

Optional context

Return Value

bool|null

bool 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.

Denies permission if any of the following conditions is true:

  • canView() on any extension 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

Return Value

bool

bool 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.

Denies permission if any of the following conditions is true:

  • canEdit() on any extension 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

Return Value

bool

bool 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.

Denies permission if any of the following conditions is true:

  • canDelete() returns false on any extension
  • canEdit() returns false
  • any descendant page returns false for canDelete()

Parameters

Member $member

Return Value

bool

bool canCreate(Member $member = null, array $context = [])

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

By default, permission to create at the root level is based on the SiteConfig configuration, and permission to create beneath a parent is based on the ability to edit that parent page.

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

Parameters

Member $member
array $context

Additional context-specific data which might affect whether (or where) this object could be created.

Return Value

bool

string debug()

Debugging used by Debug::show()

Return Value

string

HTML data representing this object

DBField dbObject(string $fieldName)

Return the DBField object that represents the given field.

This works similarly to obj() with 2 key differences:

  • it still returns an object even when the field has no value.
  • it only matches fields and not methods
  • it matches foreign keys generated by has_one relationships, eg, "ParentID"

Parameters

string $fieldName

Name of the field

Return Value

DBField

The field as a DBField object

mixed relObject(string $fieldPath)

Traverses to a DBField referenced by relationships between data objects.

The path to the related field is specified with dot separated syntax (eg: Parent.Child.Child.FieldName).

If a relation is blank, this will return null instead. If a relation name is invalid (e.g. non-relation on a parent) this can throw a LogicException.

Parameters

string $fieldPath

List of paths on this object. All items in this path must be ViewableData implementors

Return Value

mixed

DBField of the field on the object or a DataList instance.

Exceptions

LogicException

mixed relField(string $fieldName)

Traverses to a field referenced by relationships between data objects, returning the value The path to the related field is specified with dot separated syntax (eg: Parent.Child.Child.FieldName)

Parameters

string $fieldName string

Return Value

mixed

Will return null on a missing value

string getReverseAssociation(string $className)

Temporary hack to return an association name, based on class, to get around the mangle of having to deal with reverse lookup of relationships to determine autogenerated foreign keys.

Parameters

string $className

Return Value

string

static DataList get(string $callerClass = null, string|array $filter = "", string|array $sort = "", string $join = "", string|array $limit = null, string $containerClass = DataList::class)

Return all objects matching the filter sub-classes are automatically selected and included

$containerClass is Ignored, why?

Parameters

string $callerClass

The class of objects to be returned

string|array $filter

A filter to be inserted into the WHERE clause. Supports parameterised queries. See SQLSelect::addWhere() for syntax examples.

string|array $sort

A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used.

string $join

Deprecated 3.0 Join clause. Use leftJoin($table, $joinClause) instead.

string|array $limit

A limit expression to be inserted into the LIMIT clause.

string $containerClass

The container class to return the results in.

Return Value

DataList

The objects matching the filter, in the class specified by $containerClass

static DataObject|null get_one(string $callerClass, string|array $filter = "", bool $cache = true, string $orderby = "")

Return the first item matching the given query.

The object returned is cached, unlike DataObject::get()->first() DataList::first() and DataObject::get()->last() DataList::last()

The filter argument supports parameterised queries (see SQLSelect::addWhere() for syntax examples). Because of that (and differently from e.g. DataList::filter()) you need to manually escape the field names:

$member = DataObject::get_one('Member', [ '"FirstName"' => 'John' ]);

Parameters

string $callerClass

The class of objects to be returned

string|array $filter

A filter to be inserted into the WHERE clause.

bool $cache

Use caching

string $orderby

A sort expression to be inserted into the ORDER BY clause.

Return Value

DataObject|null

The first item matching the query

DataObject flushCache(bool $persistent = true)

Flush the cached results for all relations (has_one, has_many, many_many) Also clears any cached aggregate data.

Parameters

bool $persistent

When true will also clear persistent data stored in the Cache system. When false will just clear session-local cached data

Return Value

DataObject $this

static flush_and_destroy_cache()

Flush the get_one global cache and destroy associated objects.

static reset()

Clear the permissions cache for SiteTree

static DataObject|null get_by_id(string|int $classOrID, int|bool $idOrCache = null, bool $cache = true)

Return the given element, searching by ID.

This can be called either via DataObject::get_by_id(MyClass::class, $id) or MyClass::get_by_id($id)

The object returned is cached, unlike DataObject::get()->byID() DataList::byID()

Parameters

string|int $classOrID

The class of the object to be returned, or id if called on target class

int|bool $idOrCache

The id of the element, or cache if called on target class

bool $cache

See get_one()

Return Value

DataObject|null

The element

string baseTable()

Get the name of the base table for this object

Return Value

string

string baseClass()

Get the base class for this object

Return Value

string

array getSourceQueryParams()

No description

Return Value

array

See also

$sourceQueryParams

array getInheritableQueryParams()

Get list of parameters that should be inherited to relations on this object

Return Value

array

setSourceQueryParams(array $array)

No description

Parameters

array $array

See also

$sourceQueryParams

setSourceQueryParam(string $key, string $value)

No description

Parameters

string $key
string $value

See also

$sourceQueryParams

string getSourceQueryParam(string $key)

No description

Parameters

string $key

Return Value

string

See also

$sourceQueryParams

requireTable()

Check the database schema and update it as necessary.

requireDefaultRecords()

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().

onAfterBuild()

Invoked after every database build is complete (including after table creation and default record population).

See DatabaseAdmin::doBuild() for context.

array searchableFields()

Get the default searchable fields for this object, as defined in the $searchable_fields list. If searchable fields are not defined on the data object, uses a default selection of summary fields.

Return Value

array

array fieldLabels(bool $includerelations = true)

No description

Parameters

bool $includerelations

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

Return Value

array

Array of all element labels

string fieldLabel(string $name)

Get a human-readable label for a single field, see fieldLabels() for more details.

Parameters

string $name

Name of the field

Return Value

string

Label of the field

array summaryFields()

Get the default summary fields for this object.

use the translation apparatus to return a default field selection for the language

Return Value

array

array defaultSearchFilters()

Defines a default list of filters for the search context.

If a filter class mapping is defined on the data object, it is constructed here. Otherwise, the default filter specified in DBField is used.

error handling/type checking for valid FormField and SearchFilter subclasses?

Return Value

array

bool isInDB()

No description

Return Value

bool

True if the object is in the database

static disable_subclass_access()

Temporarily disable subclass access in data object qeur

static enable_subclass_access()

No description

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.

Return Value

array

Map of keys to default values, which are strings in the default case, and array-form for pluralisations.

DataObject getJoin()

If selected through a many_many through relation, this is the instance of the joined record

Return Value

DataObject

$this setJoin(DataObject $object, string $alias = null)

Set joining object

Parameters

DataObject $object
string $alias Alias

Return Value

$this

ArrayList findRelatedObjects(string $source, bool $recursive = true, ArrayList $list = null)

Find objects in the given relationships, merging them into the given list

Parameters

string $source

Config property to extract relationships from

bool $recursive

True if recursive

ArrayList $list

If specified, items will be added to this list. If not, a new instance of ArrayList will be constructed and returned

Return Value

ArrayList

The list of related objects

ArrayList mergeRelatedObjects(ArrayList $list, mixed $items)

Helper method to merge owned/owning items into a list.

Items already present in the list will be skipped.

Parameters

ArrayList $list

Items to merge into

mixed $items

List of new items to merge

Return Value

ArrayList

List of all newly added items that did not already exist in $list

string getUniqueKey()

Generate a unique key for data object the unique key uses the DataObject::getUniqueKeyComponents() extension point so unique key modifiers such as versioned or fluent are covered i.e. same data object in different stages or different locales will produce different unique key

recommended use:

  • when you need unique key for caching purposes
  • when you need unique id on the front end (for example JavaScript needs to target specific element)

Return Value

string

Exceptions

Exception

protected mergeRelatedObject(ArrayList $list, ArrayList $added, DataObject $item)

Merge single object into a list, but ensures that existing objects are not re-added.

Parameters

ArrayList $list

Global list

ArrayList $added

Additional list to insert into

DataObject $item

Item to add

Fetches the SiteTree object that maps to a link.

If you have enabled SiteTree::config()->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 extended alternateGetByLink method provided by a extension attached to SiteTree

Parameters

string $link

The link of the page to search for

bool $cache

True (default) to use caching, false to force a fresh search from the database

Return Value

SiteTree|null

static array page_type_classes()

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

Return Value

array

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

Parameters

array $arguments
string $content
ShortcodeParser $parser

Return Value

string

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

Parameters

string $action

Optional controller action (method). Note: URI encoding of this parameter is applied automatically through template casting, don't encode the passed parameter. Please use Controller::join_links() instead to append GET parameters.

Return Value

string

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

Parameters

string $action

See Link()

Return Value

string

Base link used for previewing. Defaults to absolute URL, in order to account for domain changes, e.g. on multi site setups. Does not contain hints about the stage, see SilverStripeNavigator for details.

Parameters

string $action

Return Value

string

Link to the end-user view for this record. Example: http://mysite.com/my-record

string getMimeType()

To determine preview mechanism (e.g. embedded / iframe)

Return Value

string

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

By default, if 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

string $action

See Link()

Return Value

string

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

Parameters

bool $includeStageEqualsLive

Whether to append the URL with ?stage=Live to force Live mode

Return Value

string

Generates a link to edit this page in the CMS.

Implemented here to satisfy the CMSPreviewable interface, but data is intended to be loaded via Extension

Return Value

string

Link to the CMS-author view. Should point to a controller subclassing LeftAndMain. Example: http://mysite.com/admin/edit/6

See also

CMSEditLinkExtension

string ElementName()

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

Return Value

string

The URL segment

bool isCurrent()

Returns true if this is the currently active page being used to handle this request.

Return Value

bool

bool isSection()

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

Return Value

bool

bool isOrphaned()

Check if the parent of this page has been removed (or made otherwise unavailable), and is still referenced by this child. Any such orphaned page may still require access via the CMS, but should not be shown as accessible to external users.

Return Value

bool

string LinkOrCurrent()

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

Return Value

string

string LinkOrSection()

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

Return Value

string

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 Value

string

bool InSection(string $sectionName)

Check if this page is in the given current section.

Parameters

string $sectionName

Name of the section to check

Return Value

bool

True if we are in the given section

onBeforeDuplicate(SiteTree $original, bool $doWrite)

Reset Sort on duped page

Parameters

SiteTree $original
bool $doWrite

SiteTree duplicateWithChildren()

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

Return Value

SiteTree

The duplicated object

duplicateAsChild(int $id)

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

Parameters

int $id

ID of the new node's new parent

string Breadcrumbs(int $maxDepth = 20, bool $unlinked = false, bool|string $stopAtPageType = false, bool $showHidden = false, string $delimiter = '&raquo;')

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

Parameters

int $maxDepth

The maximum depth to traverse.

bool $unlinked

Whether to link page titles.

bool|string $stopAtPageType

ClassName of a page to stop the upwards traversal.

bool $showHidden

Include pages marked with the attribute ShowInMenus = 0

string $delimiter

Delimiter character (raw html)

Return Value

string

The breadcrumb trail.

ArrayList getBreadcrumbItems(int $maxDepth = 20, bool|string $stopAtPageType = false, bool $showHidden = false)

Returns a list of breadcrumbs for the current page.

Parameters

int $maxDepth

The maximum depth to traverse.

bool|string $stopAtPageType

ClassName of a page to stop the upwards traversal.

bool $showHidden

Include pages marked with the attribute ShowInMenus = 0

Return Value

ArrayList

setParent(SiteTree|int $item)

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

SiteTree|int $item

Either the parent object, or the parent ID

SiteTree getParent()

Get the parent of this page.

Return Value

SiteTree

Parent of this page

$this setCreatableChildrenCache(CacheInterface $cache)

No description

Parameters

CacheInterface $cache

Return Value

$this

CacheInterface getCreatableChildrenCache()

No description

Return Value

CacheInterface $cache

string NestedTitle(int $level = 2, string $separator = " - ")

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

Parameters

int $level

The maximum amount of levels to traverse.

string $separator

Seperating string

Return Value

string

The resulting string

bool canAddChildren(Member|int $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.

Denies permission if any of the following conditions is true:

  • alternateCanAddChildren() on a extension returns false
  • canEdit() is not granted
  • There are no classes defined in $allowed_children

Parameters

Member|int $member

Return Value

bool

True if the current user can add children

bool canPublish(Member $member = null)

Check if this page can be published

Parameters

Member $member

Return Value

bool

SiteConfig getSiteConfig()

Stub method to get the site config, unless the current class can provide an alternate.

Return Value

SiteConfig

static PermissionChecker getPermissionChecker()

No description

Return Value

PermissionChecker

bool collateDescendants(string $condition, array $collator)

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

string $condition

The PHP condition to be evaluated. The page will be called $item

array $collator

An array, passed by reference, to collect all of the matching descendants.

Return Value

bool

array MetaComponents()

Return attributes for various meta tags, plus a title tag, in a keyed array.

Array structure corresponds to arguments for HTML::create_tag(). Example:

$tags['description'] = [ // html tag type, if omitted defaults to 'meta' 'tag' => 'meta', // attributes of html tag 'attributes' => [ 'name' => 'description', 'content' => $this->customMetaDescription(), ], // content of html tag. (True meta tags don't contain content) 'content' => null ];

Return Value

array

See also

HTML::createTag

VersionProvider getVersionProvider()

No description

Return Value

VersionProvider

void setVersionProvider(VersionProvider $versionProvider)

No description

Parameters

VersionProvider $versionProvider

Return Value

void

string MetaTags(bool $includeTitle = true)

Return the title, description, keywords and language metatags.

Parameters

bool $includeTitle

Show default -tag, set to false for custom templating</p></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td><p>The XHTML metatags</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_ContentSource"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_ContentSource"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1577">at line 1577</a></div> <code> $this <strong>ContentSource</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the object that contains the content that a user would associate with this page.</p></p> <p><p>Ordinarily, this is just the page itself, but for example on RedirectorPages or VirtualPages ContentSource() will return the page that is linked to.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>$this</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_syncLinkTracking"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_syncLinkTracking"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1749">at line 1749</a></div> <code> <strong>syncLinkTracking</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Trigger synchronisation of link tracking</p></p> <p><p>{<a href="../../../SilverStripe/CMS/Model/SiteTreeLinkTracking.html">\SilverStripe\CMS\Model\SiteTreeLinkTracking::augmentSyncLinkTracking}</a></p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_flushMemberCache"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_flushMemberCache"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1784">at line 1784</a></div> <code> <strong>flushMemberCache</strong>(array $memberIDs = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Flushes the member specific cache for creatable children</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>array</td> <td>$memberIDs</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_validURLSegment"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_validURLSegment"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1860">at line 1860</a></div> <code> bool <strong>validURLSegment</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns true if this object has a URLSegment value that does not conflict with any other objects. This method checks for:</p> <ul> <li>A page with the same URLSegment that has a conflict</li> <li>Conflicts with actions on the parent page</li> <li>A conflict caused by a root page having the same URLSegment as a class name</li> </ul></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_generateURLSegment"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_generateURLSegment"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1910">at line 1910</a></div> <code> string <strong>generateURLSegment</strong>(string $title) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Generate a URL segment based on the title provided.</p></p> <p><p>If Extensions wish to alter URL segment generation, they can do so by defining updateURLSegment(&$url, $title). $url will be passed by reference and should be modified. $title will contain the title that was originally used as the source of this generated URL. This lets extensions either start from scratch, or incrementally modify the generated URL.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$title</td> <td><p>Page title</p></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td><p>Generated url segment</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getStageURLSegment"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getStageURLSegment"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1931">at line 1931</a></div> <code> string <strong>getStageURLSegment</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Gets the URL segment for the latest draft version of this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getLiveURLSegment"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getLiveURLSegment"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1946">at line 1946</a></div> <code> string <strong>getLiveURLSegment</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Gets the URL segment for the currently published version of this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_BackLinkTracking"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_BackLinkTracking"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L1961">at line 1961</a></div> <code> <a href="../../../SilverStripe/ORM/ArrayList.html"><abbr title="SilverStripe\ORM\ArrayList">ArrayList</abbr></a>|<a href="../../../SilverStripe/ORM/DataObject.html"><abbr title="SilverStripe\ORM\DataObject">DataObject</abbr></a>[] <strong>BackLinkTracking</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get the back-link tracking objects that link to this page</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/ORM/ArrayList.html"><abbr title="SilverStripe\ORM\ArrayList">ArrayList</abbr></a>|<a href="../../../SilverStripe/ORM/DataObject.html"><abbr title="SilverStripe\ORM\DataObject">DataObject</abbr></a>[]</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_DependentPages"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_DependentPages"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2003">at line 2003</a></div> <code> <a href="../../../SilverStripe/ORM/ArrayList.html"><abbr title="SilverStripe\ORM\ArrayList">ArrayList</abbr></a>|<a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a>[] <strong>DependentPages</strong>(bool $includeVirtuals = true) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the pages that depend on this page. This includes virtual pages, pages that link to it, etc.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td>$includeVirtuals</td> <td><p>Set to false to exlcude virtual pages.</p></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/ORM/ArrayList.html"><abbr title="SilverStripe\ORM\ArrayList">ArrayList</abbr></a>|<a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a>[]</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_VirtualPages"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_VirtualPages"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2053">at line 2053</a></div> <code> <a href="../../../SilverStripe/ORM/DataList.html"><abbr title="SilverStripe\ORM\DataList">DataList</abbr></a> <strong>VirtualPages</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return all virtual pages that link to this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/ORM/DataList.html"><abbr title="SilverStripe\ORM\DataList">DataList</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getSettingsFields"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getSettingsFields"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2239">at line 2239</a></div> <code> <a href="../../../SilverStripe/Forms/FieldList.html"><abbr title="SilverStripe\Forms\FieldList">FieldList</abbr></a> <strong>getSettingsFields</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns fields related to configuration aspects on this record, e.g. access control. See getCMSFields() for content-related fields.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/Forms/FieldList.html"><abbr title="SilverStripe\Forms\FieldList">FieldList</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_onAfterPublish"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_onAfterPublish"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2594">at line 2594</a></div> <code> <strong>onAfterPublish</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_onAfterRevertToLive"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_onAfterRevertToLive"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2611">at line 2611</a></div> <code> <strong>onAfterRevertToLive</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Update draft dependant pages</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_isParentArchived"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_isParentArchived"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2632">at line 2632</a></div> <code> protected bool <strong>isParentArchived</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Determine if this page references a parent which is archived, and not available in stage</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td><p>True if there is an archived parent</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_doRestoreToStage"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_doRestoreToStage"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2649">at line 2649</a></div> <code> <a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <strong>doRestoreToStage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Restore the content in the active copy of this SiteTree page to the stage site.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_isNew"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_isNew"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2677">at line 2677</a></div> <code> bool <strong>isNew</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Check if this page is new - that is, if it has yet to have been written to the database.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getClassDropdown"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getClassDropdown"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2701">at line 2701</a></div> <code> protected array <strong>getClassDropdown</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get the class dropdown used in the CMS to change the class of a page. This returns the list of options in the dropdown as a Map from class name to singular name. Filters by SiteTree->canCreate(), as well as SiteTree::$needs_permission.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_allowedChildren"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_allowedChildren"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2755">at line 2755</a></div> <code> string[] <strong>allowedChildren</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns an array of the class names of classes that are allowed to be children of this class.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string[]</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_creatableChildren"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_creatableChildren"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2805">at line 2805</a></div> <code> array <strong>creatableChildren</strong>() <small><span class="label label-danger">deprecated</span></small></code> </h3> <div class="details"> <p> <small><span class="label label-danger">deprecated</span></small> <tr> <td>4.12.0</td> <td>Use creatableChildPages() instead Gets a list of the page types that can be created under this specific page</td> </tr> </p> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_creatableChildPages"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_creatableChildPages"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2833">at line 2833</a></div> <code> array <strong>creatableChildPages</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Gets a list of the page types that can be created under this specific page, including font icons</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_defaultChild"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_defaultChild"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2867">at line 2867</a></div> <code> string <strong>defaultChild</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the class name of the default class for children of this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_defaultParent"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_defaultParent"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2885">at line 2885</a></div> <code> string <strong>defaultParent</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the class name of the default class for the parent of this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getMenuTitle"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getMenuTitle"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2896">at line 2896</a></div> <code> string <strong>getMenuTitle</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>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.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_setMenuTitle"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_setMenuTitle"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2911">at line 2911</a></div> <code> <strong>setMenuTitle</strong>(string $value) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Set the menu title for this page.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$value</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getStatusFlags"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getStatusFlags"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2935">at line 2935</a></div> <code> array <strong>getStatusFlags</strong>(bool $cached = true) </code> </h3> <div class="details"> <div class="method-description"> <p><p>A flag provides the user with additional data about the current page status, for example a "removed from draft" status. Each page can have more than one status flag. Returns a map of a unique key to a (localized) title for the flag. The unique key can be reused as a CSS class. Use the 'updateStatusFlags' extension point to customize the flags.</p></p> <p><p>Example (simple): "deletedonlive" => "Deleted"</p> <p>Example (with optional title attribute): "deletedonlive" => ['text' => "Deleted", 'title' => 'This page has been deleted']</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td>$cached</td> <td><p>Whether to serve the fields from cache; false regenerate them</p></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getIconClass"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getIconClass"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2974">at line 2974</a></div> <code> string <strong>getIconClass</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the CSS class used for the page icon in the site tree.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getTreeTitle"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getTreeTitle"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L2989">at line 2989</a></div> <code> string <strong>getTreeTitle</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>getTreeTitle will return three <span> html DOM elements, an empty <span> with the class 'jstree-pageicon' in front, following by a <span> wrapping around its MenuTitle, then following by a <span> indicating its publication status.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td><p>An HTML string ready to be directly used in a template</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_Level"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_Level"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3023">at line 3023</a></div> <code> <a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <strong>Level</strong>(int $level) </code> </h3> <div class="details"> <div class="method-description"> <p><p>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.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>int</td> <td>$level</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getPageLevel"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getPageLevel"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3039">at line 3039</a></div> <code> int <strong>getPageLevel</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Gets the depth of this page in the sitetree, where 1 is the root level</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>int</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getControllerName"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getControllerName"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3053">at line 3053</a></div> <code> string <strong>getControllerName</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Find the controller name by our convention of {$ModelClass}Controller Can be overriden by config variable</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_CMSTreeClasses"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_CMSTreeClasses"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3107">at line 3107</a></div> <code> string <strong>CMSTreeClasses</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return the CSS classes to apply to this node in the CMS tree.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_disableCMSFieldsExtensions"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_disableCMSFieldsExtensions"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3137">at line 3137</a></div> <code> static <strong>disableCMSFieldsExtensions</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Stops extendCMSFields() being called on getCMSFields(). This is useful when you need access to fields added by subclasses of SiteTree in a extension. Call before calling parent::getCMSFields(), and reenable afterwards.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_enableCMSFieldsExtensions"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_enableCMSFieldsExtensions"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3146">at line 3146</a></div> <code> static <strong>enableCMSFieldsExtensions</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Reenables extendCMSFields() being called on getCMSFields() after it has been disabled by disableCMSFieldsExtensions().</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_providePermissions"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_providePermissions"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3151">at line 3151</a></div> <code> <strong>providePermissions</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return a map of permission codes to add to the dropdown shown in the Security section of the CMS.</p></p> <p><p>array( 'VIEW_SITE' => 'View the site', );</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_getPageIconURL"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getPageIconURL"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3220">at line 3220</a></div> <code> string <strong>getPageIconURL</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Generate link to this page's icon</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_classDescription"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_classDescription"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3250">at line 3250</a></div> <code> string|null <strong>classDescription</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get description for this page type</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string|null</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_i18n_classDescription"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_i18n_classDescription"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3264">at line 3264</a></div> <code> string|null <strong>i18n_classDescription</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get localised description for this page</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string|null</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getParentType"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getParentType"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3296">at line 3296</a></div> <code> string <strong>getParentType</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns 'root' if the current page has no parent, or 'subpage' otherwise</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_flush"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_flush"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3315">at line 3315</a></div> <code> static <strong>flush</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Clear the creatableChildren cache on flush</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_updateDependentPages"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_updateDependentPages"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3324">at line 3324</a></div> <code> protected <strong>updateDependentPages</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Update dependant pages</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_generateChildrenCacheKey"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_generateChildrenCacheKey"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3351">at line 3351</a></div> <code> protected string <strong>generateChildrenCacheKey</strong>(int $memberID) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Cache key for creatableChildren() method</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>int</td> <td>$memberID</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getExcludedURLSegments"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getExcludedURLSegments"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3361">at line 3361</a></div> <code> protected array <strong>getExcludedURLSegments</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get the list of excluded root URL segments</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td><p>List of lowercase urlsegments</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getAnchorsOnPage"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_getAnchorsOnPage"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3385">at line 3385</a></div> <code> array <strong>getAnchorsOnPage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_isHomePage"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_isHomePage"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L3410">at line 3410</a></div> <code> bool <strong>isHomePage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns whether this is the home page or not</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_ViewerGroups"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_ViewerGroups"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L117">at line 117</a></div> <code> <a href="../../../SilverStripe/ORM/ManyManyList.html"><abbr title="SilverStripe\ORM\ManyManyList">ManyManyList</abbr></a> <strong>ViewerGroups</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>List of groups that can view this object.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/ORM/ManyManyList.html"><abbr title="SilverStripe\ORM\ManyManyList">ManyManyList</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_EditorGroups"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_EditorGroups"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L117">at line 117</a></div> <code> <a href="../../../SilverStripe/ORM/ManyManyList.html"><abbr title="SilverStripe\ORM\ManyManyList">ManyManyList</abbr></a> <strong>EditorGroups</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>List of groups that can edit this object.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/ORM/ManyManyList.html"><abbr title="SilverStripe\ORM\ManyManyList">ManyManyList</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_Parent"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_Parent"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L117">at line 117</a></div> <code> <a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <strong>Parent</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../../SilverStripe/CMS/Model/SiteTree.html"><abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_BackLinks"> <div class="location">in <a href="../../../SilverStripe/CMS/Model/SiteTree.html#method_BackLinks"> <abbr title="SilverStripe\CMS\Model\SiteTree">SiteTree</abbr></a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/4/code/Model/SiteTree.php#L117">at line 117</a></div> <code> <abbr title="SilverStripe\ORM\HasManyList|\SilverStripe\CMS\Model\SiteTreeLink[]">SiteTreeLink[]</abbr> <strong>BackLinks</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>List of SiteTreeLink objects attached to this page</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><abbr title="SilverStripe\ORM\HasManyList|\SilverStripe\CMS\Model\SiteTreeLink[]">SiteTreeLink[]</abbr></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getFooter"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/2/src/PageTypes/BasePage.php#L93">at line 93</a></div> <code> <strong>getFooter</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Get the footer holder.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_RelatedPages"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/2/src/PageTypes/BasePage.php#L98">at line 98</a></div> <code> <strong>RelatedPages</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_RelatedPagesTitle"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/2/src/PageTypes/BasePage.php#L103">at line 103</a></div> <code> <strong>RelatedPagesTitle</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_getSelectedLanguage"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/2/src/PageTypes/BasePage.php#L162">at line 162</a></div> <code> string <strong>getSelectedLanguage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns the native language name for the selected locale/language, empty string if Fluent is not available</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> </div> </div><div id="footer"> Generated by <a href="https://github.com/code-lts/doctum">Doctum, a API Documentation generator and fork of Sami</a>. <br/>Contributions to this documentation repository are welcomed <a href="https://github.com/silverstripe/api.silverstripe.org" rel="noreferrer noopener" target="_blank">on Github!</a> </div></div> </div> </body> </html>