class BasePage extends SiteTree (View source)

BasePage is the foundation which can be used for constructing your own pages.

By default it is hidden from the CMS - we rely on developers creating their own Page class in the mysite/code which will extend from the BasePage.

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

Properties

public string $class from  SS_Object
protected array $extension_instances from  SS_Object
protected $beforeExtendCallbacks

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

from  SS_Object
protected $afterExtendCallbacks

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

from  SS_Object
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 bool $destroyed

True if this DataObject has been destroyed.

from  DataObject
protected $model

The DataModel from this this object comes

from  DataObject
protected array $record

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

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
public static $cache_has_own_table

Static caches used by relevant functions.

from  DataObject
protected static $_cache_db from  DataObject
protected static $_cache_get_one from  DataObject
protected static $_cache_get_class_ancestry from  DataObject
protected static $_cache_composite_fields from  DataObject
protected static $_cache_is_composite_field from  DataObject
protected static $_cache_custom_database_fields from  DataObject
protected static $_cache_field_labels from  DataObject
protected $components

Non-static relationship cache, indexed by component name.

from  DataObject
protected $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
public static $allowed_actions

Provides a list of allowed methods that can be called via RESTful api.

from  DataObject
protected $_cache_statusFlags from  SiteTree
$related_pages_title
public $pageIcon

Methods

public static 
config()

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

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.

public static 
create()

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

public static 
singleton()

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

public static 
create_from_string($classSpec, $firstArg = null)

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

public static 
parse_class_spec($classSpec)

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string().

public static 
strong_create()

Similar to Object::create(), except that classes are only overloaded if you set the $strong parameter to TRUE when using Object::useCustomClass()

public static 
useCustomClass(string $oldClass, string $newClass, bool $strong = false)

This class allows you to overload classes with other classes when they are constructed using the factory method Object::create()

public static 
string
getCustomClass(string $class)

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

public static 
any
static_lookup($class, $name, null $default = null)

Get the value of a static property of a class, even in that property is declared protected (but not private), without any inheritance, merging or parent lookup if it doesn't exist on the given class.

public static 
get_static($class, $name, $uncached = false) deprecated

No description

public static 
set_static($class, $name, $value) deprecated

No description

public static 
uninherited_static($class, $name, $uncached = false) deprecated

No description

public static 
combined_static($class, $name, $ceiling = false) deprecated

No description

public static 
addStaticVars($class, $properties, $replace = false) deprecated

No description

public static 
add_static_var($class, $name, $value, $replace = false) deprecated

No description

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

Return TRUE if a class has a specified extension.

public static 
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, bool $includeArgumentString = false)

No description

public static 
get_extra_config_sources($class = null)

No description

public
__construct(array|null $record = null, bool $isSingleton = false, $model = null)

Construct a new DataObject.

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

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

public
bool
hasMethod(string $method)

Return TRUE if a method exists on this object

public
array
allMethodNames(bool $custom = false)

Return the names of all the methods available on this object

public
defineMethods()

Adds methods from the extensions.

protected
array
findMethodsFromExtension(object $extension)

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
createMethod(string $method, string $code)

Add an extra method using raw PHP code passed as a string

public
stat($name, $uncached = false)

No description

public
set_stat($name, $value)

No description

public
uninherited($name)

No description

public
bool
exists()

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

public
string
parentClass()

No description

public
bool
is_a(string $class)

Check if this class is an instance of a specific class, or has that class as one of its parents

public
string
__toString()

No description

public
mixed
invokeWithExtensions(string $method, mixed $argument = 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
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
array
getExtensionInstances()

Get all extension instances for this specific object instance.

public
mixed
cacheToFile(string $method, int $lifetime = 3600, string $ID = false, array $arguments = array())

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

public
clearCache($method, $ID = false, $arguments = array())

Clears the cache for the given cacheToFile call

protected
mixed
loadCache(string $cache, int $lifetime = 3600)

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

protected
saveCache(string $cache, mixed $data)

Save a piece of cached data to the file system

protected
string
sanitiseCachename(string $name)

Strip a file name of special characters so it is suitable for use as a cache file name

public static 
string
castingObjectCreator(string $fieldSchema)

Converts a field spec into an object creator. For example: "Int" becomes "new Int($fieldName);" and "Varchar(50)" becomes "new Varchar($fieldName, 50);".

public static 
array
castingObjectCreatorPair(string $fieldSchema)

Convert a field schema (e.g. "Varchar(50)") into a casting object creator array that contains both a className and castingHelper constructor code. See castingObjectCreator for more information about the constructor.

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
setField(string $fieldName, mixed $val)

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

public
unknown
deprecatedCachedCall($method, $args = null, string $identifier = null)

Method to facilitate deprecation of underscore-prefixed methods automatically being cached.

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

No description

public
setCustomisedObj(ViewableData $object)

No description

public
array
castingHelperPair(string $field)

Get the class a field on this object would be casted to, as well as the casting helper for casting a field to an object (see ViewableData::castingHelper() for information on casting helpers).

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.

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
buildCastingCache(reference $cache)

Save the casting cache for this object (including data from any failovers) into a variable

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
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
objCacheSet(string $key, mixed $value)

Store a value in the field cache

public
obj(string $fieldName, array $arguments = null, bool $forceReturnedObject = true, 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
cachedCall(string $field, array $arguments = null, 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
XML_val($field, $arguments = null, $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
RAW_val($field, $arguments = null, $cache = true)

Return the value of the field without any escaping being applied.

public
SQL_val($field, $arguments = null, $cache = true)

Return the value of a field in an SQL-safe format.

public
JS_val($field, $arguments = null, $cache = true)

Return the value of a field in a JavaScript-save format.

public
ATT_val($field, $arguments = null, $cache = true)

Return the value of a field escaped suitable to be inserted into an XML node attribute.

public
array
getXMLValues($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
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(string $subtheme = false)

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

public
string
CSSClasses(string $stopAtClass = 'ViewableData')

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 
bool
get_validation_enabled() deprecated

Returns when validation on DataObjects is enabled.

public static 
set_validation_enabled($enable) deprecated

Set whether DataObjects should be validated before they are written.

public static 
clear_classname_spec_cache()

Clear all cached classname specs. It's necessary to clear all cached subclassed names for any classes if a new class manifest is generated.

public static 
string
get_classname_spec(string $class, bool $queryDB = true)

Determines the specification for the ClassName field for the given class

public static 
array
database_fields(string $class, bool $queryDB = true)

Return the complete map of fields on this object, including "Created", "LastEdited" and "ClassName".

public static 
array
custom_database_fields(string $class)

Get all database columns explicitly defined on a class in DataObject::$db and DataObject::$has_one}. Resolves instances of {@link CompositeDBField into the actual database fields, rather than the name of the field which might not equate a database column.

public static 
string
is_composite_field(string $class, string $name, bool $aggregated = true)

Returns the field class if the given db field on the class is a composite field.

public static 
composite_fields($class, $aggregated = true)

Returns a list of all the composite if the given db field on the class is a composite field.

public
setDataModel(DataModel $model)

Set the DataModel

public
destroy()

Destroy all of this objects dependant objects and local caches.

public
duplicate($doWrite = true)

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

from  SiteTree
protected
duplicateManyManyRelations($sourceObject, $destinationObject)

Copies the many_many and belongs_many_many relations from one object to another instance of the name of object The destinationObject must be written to the database already and have an ID. Writing is performed automatically when adding the new relations.

public
getObsoleteClassName()

No description

public
getClassName()

No description

public
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
singular_name()

Get the user friendly singular name of this DataObject.

public
string
i18n_singular_name()

Return the translated Singular name.

from  SiteTree
public
string
plural_name()

Get the user friendly plural name of this DataObject If the name is not defined (by renaming $plural_name in the subclass), this returns a pluralised version of the class name.

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($rightObj, $priority = 'right', $includeRelations = true, $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.

protected
validate()

Validate the current object.

from  SiteTree
public
doValidate()

Public accessor for {DataObject::validate()}

protected
onBeforeWrite()

Event handler called before writing to the database.

from  SiteTree
public
onAfterWrite()

Event handler called after writing to the database.

from  SiteTree
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 $writeComponents = false)

Writes all changes to this object to the database.

public
writeRelations()

Writes cached relation lists to the database, if possible

public
writeComponents($recursive = false)

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 component object from a one to one relationship, as a DataObject.

public
getComponents(string $componentName, string|null $filter = null, string|null|array $sort = null, string $join = null, string|null|array $limit = null)

Returns a one-to-many relation as a HasManyList

public
getComponentsQuery($componentName, $filter = "", $sort = "", $join = "", $limit = "") deprecated

No description

public
string
getRelationClass($relationName)

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

public
string
getRemoteJoinField(string $component, string $type = 'has_many', bool $polymorphic = false)

Tries to find the database key on another object that is used to store a relationship to this class. If no join field can be found it defaults to 'ParentID'.

public
getManyManyComponents(string $componentName, $filter = null, $sort = null, $join = null, $limit = null)

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

public
array|null
has_one(string $component = null) deprecated

No description

public
string|array
hasOne(string $component = null)

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|null
hasOneComponent(string $component)

Return data for a specific has_one component.

public
array|null
belongs_to(string $component = null, bool $classOnly = true) deprecated

No description

public
string|array
belongsTo(string $component = null, 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|false
belongsToComponent(string $component, bool $classOnly = true)

Return data for a specific belongs_to component.

public
array
db(string $fieldName = null)

Return all of the database fields defined in self::$db and all the parent classes.

public
array|null
has_many(string $component = null, bool $classOnly = true) deprecated

No description

public
string|array|false
hasMany(string $component = null, 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
string|false
hasManyComponent(string $component, bool $classOnly = true)

Return data for a specific has_many component.

public
array
many_many_extraFields(string $component = null) deprecated

No description

public
array|null
manyManyExtraFields(string $component = null)

Return the many-to-many extra fields specification.

public
array|null
manyManyExtraFieldsForComponent(string $component)

Return the many-to-many extra fields specification for a specific component.

public
array|null
many_many(string $component = null) deprecated

No description

public
array|null
manyMany(string $component = null)

Return information about a many-to-many component.

public
array|null
manyManyComponent(string $component)

Return information about a specific many_many component. Returns a numeric array of: array(

, The class that relation is defined in e.g. "Product" , The target class of the relation e.g. "Category" , The field name pointing to 's table e.g. "ProductID" , The field name pointing to 's table e.g. "CategoryID" The join table between the two classes e.g. "Product_Categories" )

public
array
database_extensions($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
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

public
getCMSFields()

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

public
an
getCMSActions()

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

from  SiteTree
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 $tableClass = null)

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

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

Return the fields that have changed.

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
setCastedField($fieldName, $val)

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
string
hasOwnTableDatabaseField(string $field)

Returns the field type of the given field, if it belongs to this class, and not a parent.

public static 
string
has_own_table_database_field(string $class, string $field)

Returns the field type of the given field, if it belongs to this class, and not a parent.

public static 
bool
has_own_table(string $dataClass)

Returns true if given class has its own table. Uses the rules for whether the table should exist rather than actually looking in the database.

public
bool
can(string $perm, Member $member = null)

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)

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)

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
string
relField($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($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')

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

public
Aggregate($class = null) deprecated

No description

public
RelationshipAggregate($relationship) deprecated

No description

public static 
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 
get_by_id(string $callerClass, int $id, bool $cache = true)

Return the given element, searching by ID

public
baseTable()

Get the name of the base table for this object

public
array
getSourceQueryParams()

No description

public
setSourceQueryParams($array)

No description

public
setSourceQueryParam($key, $value)

No description

public
mixed
getSourceQueryParam($key)

No description

public
databaseIndexes()

Return the database indexes on this table.

protected
array
parseSortColumn(string $column)

Parses a specified column into a sort field and direction

public
requireTable()

Check the database schema and update it as necessary.

protected
validateModelDefinitions()

Validate that the configured relations for this class use the correct syntaxes

public
requireDefaultRecords()

Add default records to database.

from  SiteTree
public
inheritedDatabaseFields()

Returns fields bu traversing the class heirachy in a bottom-up direction.

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|string
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 static 
set_enforce_strict_hierarchy($to) deprecated

Determines if the system should avoid orphaned pages by deleting all children when the their parent is deleted (TRUE), or rather preserve this data even if its not reachable through any navigation path (FALSE).

from  SiteTree
public static 
bool
get_enforce_strict_hierarchy() deprecated

No description

from  SiteTree
public static 
bool
nested_urls() deprecated

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

from  SiteTree
public static 
enable_nested_urls() deprecated

No description

from  SiteTree
public static 
disable_nested_urls() deprecated

No description

from  SiteTree
public static 
set_create_default_pages(bool $option = true) deprecated

Set the (re)creation of default pages on /dev/build

from  SiteTree
public static 
bool
get_create_default_pages() deprecated

Return true if default pages should be created on /dev/build.

from  SiteTree
public static 
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, TextParser $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
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
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
Breadcrumbs(int $maxDepth = 20, bool $unlinked = false, bool|string $stopAtPageType = false, bool $showHidden = false)

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

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

from  SiteTree
public
canDeleteFromLive($member = null)

No description

from  SiteTree
public
getSiteConfig()

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

from  SiteTree
public static 
prepopulate_permission_cache(string $permission = 'CanEditType', array $ids, callable|string $batchCallback = null)

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

from  SiteTree
public static 
array
batch_permission_check(array $ids, int $memberID, string $typeField, string $groupJoinTable, string $siteConfigMethod, string $globalPermission = null, bool $useCached = true, array $stages = array('Stage', 'Live'))

This method is NOT a full replacement for the individual can*() methods, e.g. canEdit(). Rather than checking (potentially slow) PHP logic, it relies on the database group associations, e.g. the "CanEditType" field plus the "SiteTree_EditorGroups" many-many table. By batch checking multiple records, we can combine the queries efficiently.

from  SiteTree
public static 
array
can_edit_multiple(array $ids, int $memberID, bool $useCached = true)

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

from  SiteTree
public static 
array
can_delete_multiple(array $ids, int $memberID, bool $useCached = true)

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

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

Collate selected descendants of this page.

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

No description

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
rewriteFileURL($old, $new)

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

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
bool
doPublish()

Publish this page.

from  SiteTree
public
doUnpublish()

Remove linked pdf when unpublishing the page, so it's no longer valid.

public
doRevertToLive()

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

from  SiteTree
protected
bool
isParentArchived()

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

from  SiteTree
public
doRestoreToStage()

No description

public
bool
doArchive()

Removes the page from both live and stage, if it exists on both otherwise just removes from stage

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

Check if the current user is allowed to archive this page.

from  SiteTree
public
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
public
bool
isPublished()

Check if this page has been published.

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

getTreeTitle will return three html DOM elements, an empty with the class 'jstree-pageicon' in front, following by a wrapping around its MenutTitle, 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
CMSTreeClasses(string $numChildrenMethod = "numChildren")

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

from  SiteTree
public
bool
getIsDeletedFromStage()

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

from  SiteTree
public
bool
getExistsOnLive()

Return true if this page exists on the live site

from  SiteTree
public
bool
getIsModifiedOnStage()

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

from  SiteTree
public
bool
getIsAddedToStage()

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

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

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

from  SiteTree
public static 
on_db_reset()

No description

from  SiteTree
ViewerGroups()

List of groups that can view this object.

from  SiteTree
EditorGroups()

List of groups that can edit this object.

from  SiteTree
BackLinkTracking()

List of site pages that link to this page.

from  SiteTree
public
getFooter()

Get the footer holder.

public
getPdfFilename()

Return the full filename of the pdf file, including path & extension

public
PdfLink()

Build pdf link for template.

public
RelatedPages()

No description

public
RelatedPagesTitle()

No description

public
onAfterPublish($original)

Remove linked pdf when publishing the page, as it would be out of date.

public
getAvailableTranslations()

Provides data for translation navigation.

public
string
getSelectedLanguage()

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

Details

static Config_ForClass|null config()

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

Return Value

Config_ForClass|null

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

static SS_Object create()

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

This method first for strong class overloads (singletons & DB interaction), then custom class overloads. If an overload is found, an instance of this is returned rather than the original class. To overload a class, use Object::useCustomClass()

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'); $list = SiteTree::get();

Return Value

SS_Object

static SS_Object singleton()

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

Return Value

SS_Object

The singleton instance

static create_from_string($classSpec, $firstArg = null)

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

Construction itself is done with Object::create(), so that Object::useCustomClass() calls are respected.

Object::create_from_string("Versioned('Stage','Live')") will return the result of Versioned::create('Stage', 'Live);

It is designed for simple, clonable objects. The first time this method is called for a given string it is cached, and clones of that object are returned.

If you pass the $firstArg argument, this will be prepended to the constructor arguments. It's impossible to pass null as the firstArg argument.

Object::create_from_string("Varchar(50)", "MyField") will return the result of Vachar::create('MyField', '50');

Arguments are always strings, although this is a quirk of the current implementation rather than something that can be relied upon.

Parameters

$classSpec
$firstArg

static parse_class_spec($classSpec)

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string().

Returns a 2-elemnent array, with classname and arguments

Parameters

$classSpec

static SS_Object strong_create()

Similar to Object::create(), except that classes are only overloaded if you set the $strong parameter to TRUE when using Object::useCustomClass()

Return Value

SS_Object

static useCustomClass(string $oldClass, string $newClass, bool $strong = false)

This class allows you to overload classes with other classes when they are constructed using the factory method Object::create()

Parameters

string $oldClass

the class to replace

string $newClass

the class to replace it with

bool $strong

allows you to enforce a certain class replacement under all circumstances. This is used in singletons and DB interaction classes

static string getCustomClass(string $class)

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

Parameters

string $class

the class to check

Return Value

string

the class that would be created if you called Object::create() with the class

static any static_lookup($class, $name, null $default = null)

Get the value of a static property of a class, even in that property is declared protected (but not private), without any inheritance, merging or parent lookup if it doesn't exist on the given class.

Parameters

$class
  • The class to get the static from
$name
  • The property to get from the class
null $default
  • The value to return if property doesn't exist on class

Return Value

any
  • The value of the static property $name on class $class, or $default if that property is not defined

static get_static($class, $name, $uncached = false) deprecated

deprecated

No description

Parameters

$class
$name
$uncached

static set_static($class, $name, $value) deprecated

deprecated

No description

Parameters

$class
$name
$value

static uninherited_static($class, $name, $uncached = false) deprecated

deprecated

No description

Parameters

$class
$name
$uncached

static combined_static($class, $name, $ceiling = false) deprecated

deprecated

No description

Parameters

$class
$name
$ceiling

static addStaticVars($class, $properties, $replace = false) deprecated

deprecated

No description

Parameters

$class
$properties
$replace

static add_static_var($class, $name, $value, $replace = false) deprecated

deprecated

No description

Parameters

$class
$name
$value
$replace

static 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

if 1 argument supplied, the class name of the extension to check for; if 2 supplied, the class name to test

string $requiredExtension

used only if 2 arguments supplied

bool $strict

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

static 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')"

See also

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

static remove_extension(string $extension)

Remove an extension from a class.

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

Classname of an Extension subclass, without parameters

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

No description

Parameters

string $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 classnames, or eval'ed classname strings with constructor arguments.

static get_extra_config_sources($class = null)

No description

Parameters

$class

__construct(array|null $record = null, bool $isSingleton = false, $model = null)

Construct a new DataObject.

Parameters

array|null $record

Used internally for rehydrating an object from database content. Bypasses setters on this class, and hence should not be used for populating data on new records.

bool $isSingleton

This this to true if this is a singleton() object, a stub for calling methods. Singletons don't have their defaults set.

$model

mixed __call(string $method, array $arguments)

Attemps 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

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

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

defineMethods()

Adds methods from the extensions.

Called by Object::__construct() once per class.

protected array findMethodsFromExtension(object $extension)

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

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 createMethod(string $method, string $code)

Add an extra method using raw PHP code passed as a string

Parameters

string $method

the method name

string $code

the PHP code - arguments will be in an array called $args, while you can access this object by using $obj. Note that you cannot call protected methods, as the method is actually an external function

stat($name, $uncached = false)

No description

Parameters

$name
$uncached

See also

SS_Object::get_static

set_stat($name, $value)

No description

Parameters

$name
$value

See also

SS_Object::set_static

uninherited($name)

No description

Parameters

$name

See also

SS_Object::uninherited_static

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

No description

Return Value

string

this classes parent class

bool is_a(string $class)

Check if this class is an instance of a specific class, or has that class as one of its parents

Parameters

string $class

Return Value

bool

string __toString()

No description

Return Value

string

the class name

mixed invokeWithExtensions(string $method, mixed $argument = null)

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

integrate inheritance rules

Parameters

string $method

the method name to call

mixed $argument

a single argument to pass

Return Value

mixed

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 getExtensionInstance(string $extension)

Get an extension instance attached to this object by name.

Parameters

string $extension

Return Value

Extension

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

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

Return Value

array

Map of DataExtension instances, keyed by classname.

mixed cacheToFile(string $method, int $lifetime = 3600, string $ID = false, array $arguments = array())

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

Parameters

string $method

the method name to cache

int $lifetime

the cache lifetime in seconds

string $ID

custom cache ID to use

array $arguments

an optional array of arguments

Return Value

mixed

the cached data

clearCache($method, $ID = false, $arguments = array())

Clears the cache for the given cacheToFile call

Parameters

$method
$ID
$arguments

protected mixed loadCache(string $cache, int $lifetime = 3600)

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

Parameters

string $cache

the cache name

int $lifetime

the lifetime (in seconds) of the cache before it is invalid

Return Value

mixed

protected saveCache(string $cache, mixed $data)

Save a piece of cached data to the file system

Parameters

string $cache

the cache name

mixed $data

data to save (must be serializable)

protected string sanitiseCachename(string $name)

Strip a file name of special characters so it is suitable for use as a cache file name

Parameters

string $name

Return Value

string

the name with all special cahracters replaced with underscores

static string castingObjectCreator(string $fieldSchema)

Converts a field spec into an object creator. For example: "Int" becomes "new Int($fieldName);" and "Varchar(50)" becomes "new Varchar($fieldName, 50);".

Parameters

string $fieldSchema

The field spec

Return Value

string

static array castingObjectCreatorPair(string $fieldSchema)

Convert a field schema (e.g. "Varchar(50)") into a casting object creator array that contains both a className and castingHelper constructor code. See castingObjectCreator for more information about the constructor.

Parameters

string $fieldSchema

Return Value

array

bool __isset(string $property)

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

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

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

unknown deprecatedCachedCall($method, $args = null, string $identifier = null)

Method to facilitate deprecation of underscore-prefixed methods automatically being cached.

Parameters

$method
$args
string $identifier

an optional custom cache identifier

Return Value

unknown

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

ViewableData getCustomisedObj()

No description

Return Value

ViewableData

setCustomisedObj(ViewableData $object)

No description

Parameters

ViewableData $object

array castingHelperPair(string $field)

Get the class a field on this object would be casted to, as well as the casting helper for casting a field to an object (see ViewableData::castingHelper() for information on casting helpers).

The returned array contains two keys:

  • className: the class the field would be casted to (e.g. "Varchar")
  • castingHelper: the casting helper for casting the field (e.g. "return new Varchar($fieldName)")

Parameters

string $field

Return Value

array

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.

Parameters

string $field

Return Value

string

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'

buildCastingCache(reference $cache)

Save the casting cache for this object (including data from any failovers) into a variable

Parameters

reference $cache

HTMLText 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

HTMLText

protected 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

protected mixed objCacheGet(string $key)

Get a cached value from the field cache

Parameters

string $key

Cache key

Return Value

mixed

protected objCacheSet(string $key, mixed $value)

Store a value in the field cache

Parameters

string $key

Cache key

mixed $value

obj(string $fieldName, array $arguments = null, bool $forceReturnedObject = true, 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 $forceReturnedObject

if TRUE, the value will ALWAYS be casted to an object before being returned, even if there is no explicit casting information

bool $cache

Cache this object

string $cacheName

a custom cache name

cachedCall(string $field, array $arguments = null, 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

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

XML_val($field, $arguments = null, $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

$field
$arguments
$cache

RAW_val($field, $arguments = null, $cache = true)

Return the value of the field without any escaping being applied.

Parameters

$field
$arguments
$cache

SQL_val($field, $arguments = null, $cache = true)

Return the value of a field in an SQL-safe format.

Parameters

$field
$arguments
$cache

JS_val($field, $arguments = null, $cache = true)

Return the value of a field in a JavaScript-save format.

Parameters

$field
$arguments
$cache

ATT_val($field, $arguments = null, $cache = true)

Return the value of a field escaped suitable to be inserted into an XML node attribute.

Parameters

$field
$arguments
$cache

array getXMLValues($fields)

Get an array of XML-escaped values by field name

Parameters

$fields

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

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(string $subtheme = false)

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.

Parameters

string $subtheme

the subtheme path to get

Return Value

string

string CSSClasses(string $stopAtClass = 'ViewableData')

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 bool get_validation_enabled() deprecated

deprecated 3.2 Use the "DataObject.validation_enabled" config setting instead

Returns when validation on DataObjects is enabled.

Return Value

bool

static set_validation_enabled($enable) deprecated

deprecated 3.2 Use the "DataObject.validation_enabled" config setting instead

Set whether DataObjects should be validated before they are written.

Caution: Validation can contain safeguards against invalid/malicious data, and check permission levels (e.g. on Group). Therefore it is recommended to only disable validation for very specific use cases.

Parameters

$enable bool

See also

DataObject::validate

static clear_classname_spec_cache()

Clear all cached classname specs. It's necessary to clear all cached subclassed names for any classes if a new class manifest is generated.

static string get_classname_spec(string $class, bool $queryDB = true)

Determines the specification for the ClassName field for the given class

Parameters

string $class
bool $queryDB

Determine if the DB may be queried for additional information

Return Value

string

Resulting ClassName spec. If $queryDB is true this will include all legacy types that no longer have concrete classes in PHP

static array database_fields(string $class, bool $queryDB = true)

Return the complete map of fields on this object, including "Created", "LastEdited" and "ClassName".

See custom_database_fields() for a getter that excludes these "base fields".

Parameters

string $class
bool $queryDB

Determine if the DB may be queried for additional information

Return Value

array

static array custom_database_fields(string $class)

Get all database columns explicitly defined on a class in DataObject::$db and DataObject::$has_one}. Resolves instances of {@link CompositeDBField into the actual database fields, rather than the name of the field which might not equate a database column.

Does not include "base fields" like "ID", "ClassName", "Created", "LastEdited", see database_fields().

Parameters

string $class

Return Value

array

Map of fieldname to specification, similiar to DataObject::$db.

static string is_composite_field(string $class, string $name, bool $aggregated = true)

Returns the field class if the given db field on the class is a composite field.

Will check all applicable ancestor classes and aggregate results.

Parameters

string $class

Class to check

string $name

Field to check

bool $aggregated

True if parent classes should be checked, or false to limit to this class

Return Value

string

Class name of composite field if it exists

static composite_fields($class, $aggregated = true)

Returns a list of all the composite if the given db field on the class is a composite field.

Will check all applicable ancestor classes and aggregate results.

Parameters

$class
$aggregated

DataObject setDataModel(DataModel $model)

Set the DataModel

Parameters

DataModel $model

Return Value

DataObject $this

destroy()

Destroy all of this objects dependant 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($doWrite = true)

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

Parameters

$doWrite

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

Return Value

DataObject

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

protected DataObject duplicateManyManyRelations($sourceObject, $destinationObject)

Copies the many_many and belongs_many_many relations from one object to another instance of the name of object The destinationObject must be written to the database already and have an ID. Writing is performed automatically when adding the new relations.

Parameters

$sourceObject

the source object to duplicate from

$destinationObject

the destination object to populate with the duplicated relations

Return Value

DataObject

with the new many_many relations copied in

getObsoleteClassName()

No description

getClassName()

No description

DataObject 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

DataObject $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).

Only checks for fields listed in custom_database_fields()

Use DBField->hasValue()

Return Value

bool

string singular_name()

Get the user friendly singular name of this DataObject.

If the name is not defined (by redefining $singular_name in the subclass), this returns the class name.

Return Value

string

User friendly singular name of this DataObject

string i18n_singular_name()

Return the translated Singular name.

Return Value

string

User friendly translated singular name of this DataObject

string plural_name()

Get the user friendly plural name of this DataObject If the name is not defined (by renaming $plural_name in the subclass), this returns a pluralised version of the class name.

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.

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

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

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($rightObj, $priority = 'right', $includeRelations = true, $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

$rightObj
$priority

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

$includeRelations

Boolean Merge any existing relations (optional)

$overwriteWithEmpty

Boolean 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. Only sets fields as changed if they are not already marked as changed.

Return Value

$this

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

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.

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!

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

Table and Class to select and write to

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

write(bool $showDebug = false, bool $forceInsert = false, bool $forceWrite = false, bool $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 ammend 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 $writeComponents

Call write() on all associated component instances which were previously retrieved through getComponent()}, {@link getComponents() or getManyManyComponents() (Default: false)

Exceptions

ValidationException

writeRelations()

Writes cached relation lists to the database, if possible

DataObject writeComponents($recursive = false)

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

Parameters

$recursive

Recursively write components

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

HasManyList getComponents(string $componentName, string|null $filter = null, string|null|array $sort = null, string $join = null, string|null|array $limit = null)

Returns a one-to-many relation as a HasManyList

Parameters

string $componentName

Name of the component

string|null $filter

Deprecated. A filter to be inserted into the WHERE clause

string|null|array $sort

Deprecated. A sort expression to be inserted into the ORDER BY clause. If omitted, the static field $default_sort on the component class will be used.

string $join

Deprecated, use leftJoin($table, $joinClause) instead

string|null|array $limit

Deprecated. A limit expression to be inserted into the LIMIT clause

Return Value

HasManyList

The components of the one-to-many relationship.

getComponentsQuery($componentName, $filter = "", $sort = "", $join = "", $limit = "") deprecated

deprecated

No description

Parameters

$componentName
$filter
$sort
$join
$limit

string getRelationClass($relationName)

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

Parameters

$relationName

Relation name.

Return Value

string

Class name, or null if not found.

string getRemoteJoinField(string $component, string $type = 'has_many', bool $polymorphic = false)

Tries to find the database key on another object that is used to store a relationship to this class. If no join field can be found it defaults to 'ParentID'.

If the remote field is polymorphic then $polymorphic is set to true, and the return value is in the form 'Relation' instead of 'RelationID', referencing the composite DBField.

Parameters

string $component

Name of the relation on the current object pointing to the remote object.

string $type

the join type - either 'has_many' or 'belongs_to'

bool $polymorphic

Flag set to true if the remote join field is polymorphic.

Return Value

string

ManyManyList getManyManyComponents(string $componentName, $filter = null, $sort = null, $join = null, $limit = null)

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

Implement query-params

Parameters

string $componentName

Name of the many-many component

$filter
$sort
$join
$limit

Return Value

ManyManyList

The set of components

array|null has_one(string $component = null) deprecated

deprecated 4.0 Method has been replaced by hasOne() and hasOneComponent()

No description

Parameters

string $component

Return Value

array|null

string|array hasOne(string $component = null)

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.

Parameters

string $component

Deprecated - Name of component

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|null hasOneComponent(string $component)

Return data for a specific has_one component.

Parameters

string $component

Return Value

string|null

array|null belongs_to(string $component = null, bool $classOnly = true) deprecated

deprecated 4.0 Method has been replaced by belongsTo() and belongsToComponent()

No description

Parameters

string $component
bool $classOnly

Return Value

array|null

string|array belongsTo(string $component = null, 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

string $component
  • Name of component
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|false belongsToComponent(string $component, bool $classOnly = true)

Return data for a specific belongs_to component.

Parameters

string $component
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|false

array db(string $fieldName = null)

Return all of the database fields defined in self::$db and all the parent classes.

Doesn't include any fields specified by self::$has_one. Use $this->hasOne() to get these fields

Parameters

string $fieldName

Limit the output to a specific field name

Return Value

array

The database fields

array|null has_many(string $component = null, bool $classOnly = true) deprecated

deprecated 4.0 Method has been replaced by hasMany() and hasManyComponent()

No description

Parameters

string $component
bool $classOnly

Return Value

array|null

string|array|false hasMany(string $component = null, 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

string $component

Deprecated - Name of component

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

string|false hasManyComponent(string $component, bool $classOnly = true)

Return data for a specific has_many component.

Parameters

string $component
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|false

array many_many_extraFields(string $component = null) deprecated

deprecated 4.0 Method has been replaced by manyManyExtraFields() and manyManyExtraFieldsForComponent()

No description

Parameters

string $component

Return Value

array

array|null manyManyExtraFields(string $component = null)

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.

Parameters

string $component

Deprecated - Name of component

Return Value

array|null

array|null manyManyExtraFieldsForComponent(string $component)

Return the many-to-many extra fields specification for a specific component.

Parameters

string $component

Return Value

array|null

array|null many_many(string $component = null) deprecated

deprecated 4.0 Method has been renamed to manyMany()

No description

Parameters

string $component

Return Value

array|null

array|null manyMany(string $component = null)

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.

Parameters

string $component

Deprecated - Name of component

Return Value

array|null

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

See also

DataObject::manyManyComponent

array|null manyManyComponent(string $component)

Return information about a specific many_many component. Returns a numeric array of: array(

, The class that relation is defined in e.g. "Product" , The target class of the relation e.g. "Category" , The field name pointing to 's table e.g. "ProductID" , The field name pointing to 's table e.g. "CategoryID" The join table between the two classes e.g. "Product_Categories" )

Parameters

string $component

The component name

Return Value

array|null

array database_extensions($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

$class

Return Value

array

or 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

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

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.

an 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

an

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

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 $tableClass = null)

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

Parameters

string $tableClass

Base table 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 $databaseFieldsOnly = false, int $changeLevel = self::CHANGE_STRICT)

Return the fields that have changed.

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 $databaseFieldsOnly

Get only database fields that have changed

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

setCastedField($fieldName, $val)

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

$fieldName
$val

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

string hasOwnTableDatabaseField(string $field)

Returns the field type of the given field, if it belongs to this class, and not a parent.

Note that the field type will not include constructor arguments in round brackets, only the classname.

Parameters

string $field

Name of the field

Return Value

string

The field type of the given field

static string has_own_table_database_field(string $class, string $field)

Returns the field type of the given field, if it belongs to this class, and not a parent.

Note that the field type will not include constructor arguments in round brackets, only the classname.

Parameters

string $class

Class name to check

string $field

Name of the field

Return Value

string

The field type of the given field

static bool has_own_table(string $dataClass)

Returns true if given class has its own table. Uses the rules for whether the table should exist rather than actually looking in the database.

Parameters

string $dataClass

Return Value

bool

bool can(string $perm, Member $member = null)

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.

Return Value

bool

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

bool|null extendedCan(string $methodName, Member|int $member)

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

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)

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

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

Parameters

string $fieldPath

Return Value

mixed

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

string relField($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

$fieldName

Return Value

string

| null - will return null on a missing value

string getReverseAssociation($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

$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')

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 SQLQuery::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

Aggregate($class = null) deprecated

deprecated

No description

Parameters

$class

RelationshipAggregate($relationship) deprecated

deprecated

No description

Parameters

$relationship

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

Return the first item matching the given query.

All calls to get_one() are cached.

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 SQLQuery::addWhere() for syntax examples.

bool $cache

Use caching

string $orderby

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

Return Value

DataObject

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 get_by_id(string $callerClass, int $id, bool $cache = true)

Return the given element, searching by ID

Parameters

string $callerClass

The class of the object to be returned

int $id

The id of the element

bool $cache

See get_one()

Return Value

DataObject

The element

baseTable()

Get the name of the base table for this object

array getSourceQueryParams()

No description

Return Value

array

See also

$sourceQueryParams

setSourceQueryParams($array)

No description

Parameters

$array

See also

$sourceQueryParams

setSourceQueryParam($key, $value)

No description

Parameters

$key
$value

See also

$sourceQueryParams

mixed getSourceQueryParam($key)

No description

Parameters

$key

Return Value

mixed

See also

$sourceQueryParams

databaseIndexes()

Return the database indexes on this table.

This array is indexed by the name of the field with the index, and the value is the type of index.

protected array parseSortColumn(string $column)

Parses a specified column into a sort field and direction

Parameters

string $column

String to parse containing the column name

Return Value

array

Resolved table and column.

requireTable()

Check the database schema and update it as necessary.

protected validateModelDefinitions()

Validate that the configured relations for this class use the correct syntaxes

Exceptions

LogicException

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

inheritedDatabaseFields()

Returns fields bu traversing the class heirachy in a bottom-up direction.

Needed to avoid getCMSFields being empty when customDatabaseFields overlooks the inheritance chain of the $db array, where a child data object has no $db array, but still needs to know the properties of its parent. This should be merged into databaseFields or customDatabaseFields.

review whether this is still needed after recent API changes

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|string fieldLabels(bool $includerelations = true)

No description

Parameters

bool $includerelations

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

Return Value

array|string

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

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

All entites in an associative array, with entity name as the key, and a numerical array of pseudo-arguments for _t() as a value.

static set_enforce_strict_hierarchy($to) deprecated

deprecated 4.0 Use the "SiteTree.enforce_strict_hierarchy" config setting instead

Determines if the system should avoid orphaned pages by deleting all children when the their parent is deleted (TRUE), or rather preserve this data even if its not reachable through any navigation path (FALSE).

Parameters

$to

static bool get_enforce_strict_hierarchy() deprecated

deprecated 4.0 Use the "SiteTree.enforce_strict_hierarchy" config setting instead

No description

Return Value

bool

static bool nested_urls() deprecated

deprecated 4.0 Use the "SiteTree.nested_urls" config setting instead

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

Return Value

bool

static enable_nested_urls() deprecated

deprecated 4.0 Use the "SiteTree.nested_urls" config setting instead

No description

static disable_nested_urls() deprecated

deprecated 4.0 Use the "SiteTree.nested_urls" config setting instead

No description

static set_create_default_pages(bool $option = true) deprecated

deprecated 4.0 Use the "SiteTree.create_default_pages" config setting instead

Set the (re)creation of default pages on /dev/build

Parameters

bool $option

static bool get_create_default_pages() deprecated

deprecated 4.0 Use the "SiteTree.create_default_pages" config setting instead

Return true if default pages should be created on /dev/build.

Return Value

bool

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

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
TextParser $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

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

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

See Link()

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.

Return Value

string

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

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

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

HTMLText Breadcrumbs(int $maxDepth = 20, bool $unlinked = false, bool|string $stopAtPageType = false, bool $showHidden = false)

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

Return Value

HTMLText

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

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)

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

Denies permission if any of the following conditions is true:

  • canPublish() on any extension returns false
  • canEdit() returns false

Parameters

Member $member

Return Value

bool

True if the current user can publish this page.

canDeleteFromLive($member = null)

No description

Parameters

$member

SiteConfig getSiteConfig()

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

Return Value

SiteConfig

static prepopulate_permission_cache(string $permission = 'CanEditType', array $ids, callable|string $batchCallback = null)

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

Parameters

string $permission

The permission: edit, view, publish, approve, etc.

array $ids

An array of page IDs

callable|string $batchCallback

The function/static method to call to calculate permissions. Defaults to 'SiteTree::can_(permission)_multiple'

static array batch_permission_check(array $ids, int $memberID, string $typeField, string $groupJoinTable, string $siteConfigMethod, string $globalPermission = null, bool $useCached = true, array $stages = array('Stage', 'Live'))

This method is NOT a full replacement for the individual can*() methods, e.g. canEdit(). Rather than checking (potentially slow) PHP logic, it relies on the database group associations, e.g. the "CanEditType" field plus the "SiteTree_EditorGroups" many-many table. By batch checking multiple records, we can combine the queries efficiently.

Caches based on $typeField data. To invalidate the cache, use SiteTree::reset() or set the $useCached property to FALSE.

Parameters

array $ids

Of SiteTree IDs

int $memberID

Member ID

string $typeField

A property on the data record, e.g. "CanEditType".

string $groupJoinTable

A many-many table name on this record, e.g. "SiteTree_EditorGroups"

string $siteConfigMethod

Method to call on SiteConfig for toplevel items, e.g. "canEdit"

string $globalPermission

If the member doesn't have this permission code, don't bother iterating deeper

bool $useCached
array $stages

Which stages to check permissions against, defaults to both Stage and Live

Return Value

array

An map of SiteTree ID keys to boolean values

static array can_edit_multiple(array $ids, int $memberID, bool $useCached = true)

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

Parameters

array $ids

An array of IDs of the SiteTree pages to look up

int $memberID

ID of member

bool $useCached

Return values from the permission cache if they exist

Return Value

array

A map where the IDs are keys and the values are booleans stating whether the given page can be edited

static array can_delete_multiple(array $ids, int $memberID, bool $useCached = true)

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

Parameters

array $ids

An array of IDs of the SiteTree pages to look up

int $memberID

ID of member

bool $useCached

Return values from the permission cache if they exist

Return Value

array

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

string MetaTags(bool $includeTitle = true)

Return the title, description, keywords and language metatags.

Move tag in separate getter for easier customization and more obvious usage</td> </tr> </p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td>$includeTitle</td> <td><p>Show default <title>-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="SiteTree.html#method_ContentSource"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1442">at line 1442</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="SiteTree.html#method_syncLinkTracking"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1553">at line 1553</a></div> <code> <strong>syncLinkTracking</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_validURLSegment"> <div class="location">in <a href="SiteTree.html#method_validURLSegment"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1654">at line 1654</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="SiteTree.html#method_generateURLSegment"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1700">at line 1700</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 <a href="Extension.html">Extension</a>s 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="SiteTree.html#method_getStageURLSegment"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1718">at line 1718</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="SiteTree.html#method_getLiveURLSegment"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1730">at line 1730</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_rewriteFileURL"> <div class="location">in <a href="SiteTree.html#method_rewriteFileURL"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1740">at line 1740</a></div> <code> <strong>rewriteFileURL</strong>($old, $new) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Rewrite a file URL on this page, after its been renamed. Triggers the onRenameLinkedAsset action on extensions.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td></td> <td>$old</td> <td></td> </tr> <tr> <td></td> <td>$new</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_DependentPages"> <div class="location">in <a href="SiteTree.html#method_DependentPages"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1779">at line 1779</a></div> <code> <a href="ArrayList.html">ArrayList</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="ArrayList.html">ArrayList</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_VirtualPages"> <div class="location">in <a href="SiteTree.html#method_VirtualPages"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L1835">at line 1835</a></div> <code> <a href="DataList.html">DataList</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="DataList.html">DataList</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getSettingsFields"> <div class="location">in <a href="SiteTree.html#method_getSettingsFields"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2057">at line 2057</a></div> <code> <a href="FieldList.html">FieldList</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="FieldList.html">FieldList</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_doPublish"> <div class="location">in <a href="SiteTree.html#method_doPublish"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2378">at line 2378</a></div> <code> bool <strong>doPublish</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Publish this page.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td><p>True if published</p></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_doUnpublish"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L114">at line 114</a></div> <code> <strong>doUnpublish</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Remove linked pdf when unpublishing the page, so it's no longer valid.</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_doRevertToLive"> <div class="location">in <a href="SiteTree.html#method_doRevertToLive"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2469">at line 2469</a></div> <code> <strong>doRevertToLive</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Revert the draft changes: replace the draft content with the content on live</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_isParentArchived"> <div class="location">in <a href="SiteTree.html#method_isParentArchived"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2493">at line 2493</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"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L129">at line 129</a></div> <code> <a href="SiteTree.html">SiteTree</a> <strong>doRestoreToStage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> <p> <tr> <td>Remove</td> <td>once CWP moves to 3.3 core (which includes this in SiteTree)</td> </tr> </p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="SiteTree.html">SiteTree</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_doArchive"> <div class="location">in <a href="SiteTree.html#method_doArchive"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2551">at line 2551</a></div> <code> bool <strong>doArchive</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Removes the page from both live and stage, if it exists on both otherwise just removes from stage</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td>Success</td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_canArchive"> <div class="location">in <a href="SiteTree.html#method_canArchive"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2576">at line 2576</a></div> <code> bool <strong>canArchive</strong>(<a href="Member.html">Member</a> $member = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Check if the current user is allowed to archive this page.</p></p> <p><p>If extended, ensure that both canDelete and canDeleteFromLive are extended also</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td><a href="Member.html">Member</a></td> <td>$member</td> <td></td> </tr> </table> <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_doDeleteFromLive"> <div class="location">in <a href="SiteTree.html#method_doDeleteFromLive"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2603">at line 2603</a></div> <code> <strong>doDeleteFromLive</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Synonym of <a href="BasePage.html#method_doUnpublish">doUnpublish</a></p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_isNew"> <div class="location">in <a href="SiteTree.html#method_isNew"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2612">at line 2612</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_isPublished"> <div class="location">in <a href="SiteTree.html#method_isPublished"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2630">at line 2630</a></div> <code> bool <strong>isPublished</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Check if this page has been published.</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="SiteTree.html#method_getClassDropdown"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2646">at line 2646</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 <a href="SiteTree.html">SiteTree::$needs_permission</a>.</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="SiteTree.html#method_allowedChildren"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2696">at line 2696</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_defaultChild"> <div class="location">in <a href="SiteTree.html#method_defaultChild"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2724">at line 2724</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="SiteTree.html#method_defaultParent"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2739">at line 2739</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="SiteTree.html#method_getMenuTitle"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2749">at line 2749</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="SiteTree.html#method_setMenuTitle"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2763">at line 2763</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="SiteTree.html#method_getStatusFlags"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2786">at line 2786</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" => array('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_getTreeTitle"> <div class="location">in <a href="SiteTree.html#method_getTreeTitle"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2828">at line 2828</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 MenutTitle, 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="SiteTree.html#method_Level"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2866">at line 2866</a></div> <code> <a href="SiteTree.html">SiteTree</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="SiteTree.html">SiteTree</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getPageLevel"> <div class="location">in <a href="SiteTree.html#method_getPageLevel"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2881">at line 2881</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_CMSTreeClasses"> <div class="location">in <a href="SiteTree.html#method_CMSTreeClasses"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2894">at line 2894</a></div> <code> string <strong>CMSTreeClasses</strong>(string $numChildrenMethod = "numChildren") </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>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$numChildrenMethod</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_getIsDeletedFromStage"> <div class="location">in <a href="SiteTree.html#method_getIsDeletedFromStage"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2932">at line 2932</a></div> <code> bool <strong>getIsDeletedFromStage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Compares current draft with live version, and returns true if no draft version of this page exists but the page is still published (eg, after triggering "Delete from draft site" in the CMS).</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_getExistsOnLive"> <div class="location">in <a href="SiteTree.html#method_getExistsOnLive"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2947">at line 2947</a></div> <code> bool <strong>getExistsOnLive</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return true if this page exists on the live site</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_getIsModifiedOnStage"> <div class="location">in <a href="SiteTree.html#method_getIsModifiedOnStage"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2957">at line 2957</a></div> <code> bool <strong>getIsModifiedOnStage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Compares current draft with live version, and returns true if these versions differ, meaning there have been unpublished changes to the draft site.</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_getIsAddedToStage"> <div class="location">in <a href="SiteTree.html#method_getIsAddedToStage"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2976">at line 2976</a></div> <code> bool <strong>getIsAddedToStage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Compares current draft with live version, and returns true if no live version exists, meaning the page was never published.</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_disableCMSFieldsExtensions"> <div class="location">in <a href="SiteTree.html#method_disableCMSFieldsExtensions"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2990">at line 2990</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="SiteTree.html#method_enableCMSFieldsExtensions"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L2998">at line 2998</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="SiteTree.html#method_providePermissions"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L3002">at line 3002</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_getParentType"> <div class="location">in <a href="SiteTree.html#method_getParentType"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L3076">at line 3076</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_on_db_reset"> <div class="location">in <a href="SiteTree.html#method_on_db_reset"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L3087">at line 3087</a></div> <code> static <strong>on_db_reset</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_ViewerGroups"> <div class="location">in <a href="SiteTree.html#method_ViewerGroups"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L37">at line 37</a></div> <code> <a href="ManyManyList.html">ManyManyList</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="ManyManyList.html">ManyManyList</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_EditorGroups"> <div class="location">in <a href="SiteTree.html#method_EditorGroups"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L37">at line 37</a></div> <code> <a href="ManyManyList.html">ManyManyList</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="ManyManyList.html">ManyManyList</a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_BackLinkTracking"> <div class="location">in <a href="SiteTree.html#method_BackLinkTracking"> SiteTree</a> <a href="https://github.com/silverstripe/silverstripe-cms/blob/3/code/model/SiteTree.php#L37">at line 37</a></div> <code> <a href="ManyManyList.html">ManyManyList</a> <strong>BackLinkTracking</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>List of site 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="ManyManyList.html">ManyManyList</a></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/1/code/pagetypes/BasePage.php#L58">at line 58</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_getPdfFilename"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L65">at line 65</a></div> <code> <strong>getPdfFilename</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Return the full filename of the pdf file, including path & extension</p></p> </div> <div class="tags"> </div> </div> </div> <div class="method-item"> <h3 id="method_PdfLink"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L77">at line 77</a></div> <code> <strong>PdfLink</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Build pdf link for template.</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/1/code/pagetypes/BasePage.php#L89">at line 89</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/1/code/pagetypes/BasePage.php#L93">at line 93</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_onAfterPublish"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L101">at line 101</a></div> <code> <strong>onAfterPublish</strong>($original) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Remove linked pdf when publishing the page, as it would be out of date.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td></td> <td>$original</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getAvailableTranslations"> <div class="location"><a href="https://github.com/silverstripe/cwp/blob/1/code/pagetypes/BasePage.php#L201">at line 201</a></div> <code> <strong>getAvailableTranslations</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Provides data for translation navigation.</p></p> <p><p>Collects all site translations, marks the current one, and redirects to the translated home page if a. there is a translated homepage and b. the translation of the specific page is not available.</p></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/1/code/pagetypes/BasePage.php#L257">at line 257</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 Translatable 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>