Version: current

# Class Page

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

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

  Object
  ViewableData implements IteratorAggregate
  DataObject implements DataObjectInterface, i18nEntityProvider
  SiteTree implements PermissionProvider, i18nEntityProvider
  Page

### Direct known subclasses

`Announcement`, `AnnouncementHolder`, `Event`, `EventHolder`, `FaqHolder`, `FaqSection`, `FavoritePage`, `Guestbook`, `HomePage`, `MapObject`, `MapObjectGroup`, `MapPage`, `BaseObjectCategory`, `MediawebPage`, `NewsEntry`, `NewsHolder`, `PhotoAlbumPage`, `PhotoGalleryPage`, `ProductSearchPage`, `ProfilePage`, `PublHolder`, `Publication`, `RedirectorPage`, `BookingAdminPage`, `RegistrationPage`, `SimpleOrderPage`, `SubscribeForm`, `SubsitesSelectorPage`, `UserDefinedForm`, `VideoBankPage`, `VirtualPage`, `BookingPage`, `CartPage`, `Catalog`, `CheckoutPage`, `DocumentsPage`, `ErrorPage`

### Indirect known subclasses

`ContactsPage`, `DocPage`, `Socle`, `SocleSize`, `SpecialCatalog`, `StartCatalog`, `SubsitesVirtualPage`, `VirtualProduct`, `Monument`, `MonumentCatalog`, `MonumentForm`, `NewsArchive`, `Product`, `Room`, `RoomCatalog`, `SimpleOrderForm`

Package: cms
Located at webylon/code/Page.php

## Methods summary

`public static` | # `set_hidden_cms_fields( array $fields )` Задает значение $hidden_cms_fields Для исопльзование в конфиге Задает значение $hidden_cms_fields Для исопльзование в конфиге #### Parameters $fields array $fields
`public` | # `hiddenCMSFields( )` Определяет какие поля надо скрыть у текущей страницы по описанию из $hidden_cms_fields Определяет какие поля надо скрыть у текущей страницы по описанию из $hidden_cms_fields
`public` | # `hide_cms_fields( `FieldSet` & $fields )` Скрывает поля из формы в CMS по описанию из $hidden_cms_fields Скрывает поля из формы в CMS по описанию из $hidden_cms_fields #### Parameters $fields FieldSet $fields
`public `Boolean`` | # `canPublish( `Member` $member = null )` Проверка возможность публикации из cli Проверка возможность публикации из cli #### Parameters $member Member $member #### Returns ``Boolean`` Boolean #### Overrides `SiteTree::canPublish`
`public `FieldSet`` | # `getCMSFields( )` Returns a FieldSet with which to create the CMS editing form. Returns a FieldSet with which to create the CMS editing form. You can override this in your child classes to add extra fields - first get the parent fields using parent::getCMSFields(), then use addFieldToTab() on the FieldSet. #### Returns ``FieldSet`` The fields to be displayed in the CMS. #### Overrides `SiteTree::getCMSFields`
`public` | # `checkDevPermisson( mixed $member = null, mixed $method = null )`
`public boolean` | # `canAddChildren( mixed $member = null )` This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application. This function should return true if the current user can add children to this page. It can be overloaded to customise the security model for an application. Denies permission if any of the following conditions is TRUE: alternateCanAddChildren() on a decorator returns FALSE canEdit() is not granted There are no classes defined in `SiteTree::$allowed_children` #### Returns `boolean` True if the current user can add children. #### Uses ``SiteTreeDecorator::canAddChildren()`` ``Page::canEdit()`` `mixed` #### Overrides `SiteTree::canAddChildren`
`public boolean` | # `canDelete( `Member` $member = null )` This function should return true if the current user can delete this page. It can be overloaded to customise the security model for an application. This function should return true if the current user can delete this page. It can be overloaded to customise the security model for an application. Denies permission if any of the following conditions is TRUE: canDelete() returns FALSE on any decorator canEdit() returns FALSE any descendant page returns FALSE for canDelete() #### Parameters $member Member $member #### Returns `boolean` True if the current user can delete this page. #### Uses ``Page::canDelete()`` ``DataObjectDecorator::canDelete()`` ``Page::canEdit()`` #### Used by ``Page::canDelete()`` #### Overrides `SiteTree::canDelete`
`public` | # `canDeleteFromLive( mixed $member = null )` #### Overrides `SiteTree::canDeleteFromLive`
`public boolean` | # `canEdit( `Member` $member = null )` This function should return true if the current user can edit this page. It can be overloaded to customise the security model for an application. This function should return true if the current user can edit this page. It can be overloaded to customise the security model for an application. Denies permission if any of the following conditions is TRUE: canEdit() on any decorator returns FALSE canView() return false "CanEditType" directive is set to "Inherit" and any parent page return false for canEdit() "CanEditType" directive is set to "LoggedInUsers" and no user is logged in or doesn't have the CMS_Access_CMSMAIN permission code "CanEditType" directive is set to "OnlyTheseUsers" and user is not in the given groups #### Parameters $member Member $member Set to FALSE if you want to explicitly test permissions without a valid user (useful for unit tests) #### Returns `boolean` True if the current user can edit this page. #### Uses ``SiteTree::canView()`` EditorGroups() ``DataObjectDecorator::canEdit()`` #### Used by ``Page::canAddChildren()`` ``Page::canDelete()`` #### Overrides `SiteTree::canEdit`
`public boolean` | # `allowComments( mixed $siteconfig = false )` Allow Comments Allow Comments #### Returns `boolean` Permission for comments #### Overrides `SiteTree::allowComments`
`public` | # `DevMode( )`
`public` | # `onBeforeWrite( )` Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though! Event handler called before writing to the database. You can overload this to clean up or otherwise process data before writing it to the database. Don't forget to call parent::onBeforeWrite(), though! This called after $this->validate(), so you can be sure that your data is valid. #### Uses ``DataObjectDecorator::onBeforeWrite()`` #### Overrides `SiteTree::onBeforeWrite`
`public` | # `onAfterWrite( )` Event handler called after writing to the database. You can overload this to act upon changes made to the data after it is written. $this->changed will have a record database. Don't forget to call parent::onAfterWrite(), though! Event handler called after writing to the database. You can overload this to act upon changes made to the data after it is written. $this->changed will have a record database. Don't forget to call parent::onAfterWrite(), though! #### Uses ``DataObjectDecorator::onAfterWrite()`` #### Overrides `SiteTree::onAfterWrite`
`public` | # `onAfterDelete( )` #### Overrides `SiteTree::onAfterDelete`
`public` | # `Lang( )`
`public` | # `Locale( )`
`public` | # `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. 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. #### Uses ``DataObjectDecorator::populateDefaults()`` #### Overrides `DataObject::populateDefaults`
`public string` | # `MetaTags( boolean|string $includeTitle = true )` Return the title, description, keywords and language metatags. Return the title, description, keywords and language metatags. #### Parameters $includeTitle boolean|string $includeTitle Show default <title>-tag, set to false for custom templating #### Returns `string` The XHTML metatags #### Overrides `SiteTree::MetaTags`
`public` | # `AdminEmail( )`
`public` | # `NestedValue( mixed $name = '' )`
`public` | # `FinalParent( mixed $url = false )`

### Methods inherited from SiteTree

`AbsoluteLink()`, `Breadcrumbs()`, `CMSTreeClasses()`, `Comments()`, `ContentSource()`, `DependentPages()`, `DependentPagesCount()`, `ElementName()`, `InSection()`, `Level()`, `Link()`, `LinkOrCurrent()`, `LinkOrSection()`, `LinkingMode()`, `NestedTitle()`, `RelativeLink()`, `TreeTitle()`, `VirtualPages()`, `allowedChildren()`, `batch_permission_check()`, `can()`, `canCreate()`, `canView()`, `can_delete_multiple()`, `can_edit_multiple()`, `cmsCleanup_parentChanged()`, `collateDescendants()`, `defaultChild()`, `defaultParent()`, `disableCMSFieldsExtensions()`, `disable_nested_urls()`, `doDeleteFromLive()`, `doPublish()`, `doRestoreToStage()`, `doRevertToLive()`, `doRollbackTo()`, `doUnpublish()`, `duplicate()`, `duplicateAsChild()`, `duplicateWithChildren()`, `enableCMSFieldsExtensions()`, `enable_nested_urls()`, `fieldLabels()`, `generateURLSegment()`, `generate_homepage_domain_map()`, `getAbsoluteLiveLink()`, `getCMSActions()`, `getClassDropdown()`, `getExistsOnLive()`, `getIsAddedToStage()`, `getIsDeletedFromStage()`, `getIsModifiedOnStage()`, `getMenuTitle()`, `getParent()`, `getParentType()`, `getSiteConfig()`, `get_by_link()`, `get_enforce_strict_hierarchy()`, `i18n_singular_name()`, `isCurrent()`, `isNew()`, `isPublished()`, `isSection()`, `link_shortcode_handler()`, `nested_urls()`, `onBeforeDelete()`, `page_type_classes()`, `prepopuplate_permission_cache()`, `provideI18nEntities()`, `providePermissions()`, `requireDefaultRecords()`, `reset()`, `rewriteFileURL()`, `setMenuTitle()`, `setParent()`, `set_enforce_strict_hierarchy()`, `syncLinkTracking()`, `validURLSegment()`

### Methods inherited from DataObject

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

### Methods inherited from ViewableData

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

### Methods inherited from Object

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

### Magic methods summary

## Properties summary

`public static array` | $db | # Database field definitions. This is a map from field names to field type. The field type should be a class that extends . Database field definitions. This is a map from field names to field type. The field type should be a class that extends .
`public static array` | $defaults | # Inserts standard column-values when a DataObject is instanciated. Does not insert default records `DataObject::$default_records`. This is a map from fieldname to default value. Inserts standard column-values when a DataObject is instanciated. Does not insert default records `DataObject::$default_records`. This is a map from fieldname to default value. If you would like to change a default value in a sub-class, just specify it. - If you would like to disable the default value given by a parent class, set the default value to 0,'',or false in your subclass. Setting it to null won't work.
`public static array` | $summary_fields | # Provides a default list of fields to be used by a 'summary' view of this object. Provides a default list of fields to be used by a 'summary' view of this object.
`public static string` | $default_child | # The default child class for this page. The default child class for this page.
`public static array` | $hidden_cms_fields | # скрытие ненужных полей из админки скрытие ненужных полей из админки пример: static $hidden_cms_fields = array( '*' => array('Field1', 'Field2'), // скрыть у всех страниц класса Field1 и Field2 'ParentID' => array( // условное скрытие по значению поля ParentID 1234 => array('Field3', 'Field4'), // если поле ParentID == 1234 - скрываем Field3 и Field4 2345 => 'Field5', // если поле ParentID == 2345 - скрываем Field5 ), )

### Properties inherited from SiteTree

`$allowed_children`, `$belongs_many_many`, `$breadcrumbs_delimiter`, `$cache_permissions`, `$can_be_root`, `$can_create`, `$casting`, `$default_parent`, `$default_sort`, `$extensions`, `$has_many`, `$has_one`, `$hide_ancestor`, `$icon`, `$indexes`, `$many_many`, `$many_many_extraFields`, `$need_permission`, `$searchable_fields`, `$versioning`, `$write_homepage_map`

### Properties inherited from DataObject

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

### Properties inherited from ViewableData

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

### Properties inherited from Object

`$class`, `$extension_instances`

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