Version: current

# Class CMSMain

The main "content" area of the CMS. This class creates a 2-frame layout - left-tree and right-form - to sit beneath the main admin menu.

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  Controller
  LeftAndMain
  CMSMain implements CurrentPageIdentifier, PermissionProvider

Package: cms\content
Located at cms/code/CMSMain.php

## Methods summary

`public static` | # `T_SiteTreeFilterOptions( )`
`public` | # `init( )` #### Uses ``LeftAndMainDecorator::init()`` ``LeftAndMainDecorator::accessedCMS()`` ``CMSMenu`` #### Overrides `LeftAndMain::init`
`public boolean` | # `ShowSwitchView( )` If this is set to true, the "switchView" context in the template is shown, with links to the staging and publish site. If this is set to true, the "switchView" context in the template is shown, with links to the staging and publish site. #### Returns `boolean` boolean #### Overrides `LeftAndMain::ShowSwitchView`
`public array` | # `SwitchView( mixed $page = null )` Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able to switch view also for archived versions. Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able to switch view also for archived versions. #### Returns `array` array #### Overrides `LeftAndMain::SwitchView`
`public string` | # `Link( mixed $action = null )` Override `LeftAndMain` Link to allow blank URL segment for CMSMain. Override `LeftAndMain` Link to allow blank URL segment for CMSMain. #### Returns `string` string #### Overrides `LeftAndMain::Link`
`public` | # `SiteTreeAsUL( )` Return the entire site tree as a nested set of ULs Return the entire site tree as a nested set of ULs
`public` | # `getCMSTreeTitle( )`
`public string` | # `getfilteredsubtree( )` Use a CMSSiteTreeFilter to only get certain nodes Use a CMSSiteTreeFilter to only get certain nodes #### Returns `string` string
`public` | # `SiteTreeFilters( )` Returns a list of batch actions Returns a list of batch actions
`public` | # `SiteTreeFilterOptions( )` Returns the SiteTree columns that can be filtered using the the Site Tree Search button as a DataObjectSet Returns the SiteTree columns that can be filtered using the the Site Tree Search button as a DataObjectSet
`public` | # `SiteTreeFilterDateField( )`
`public` | # `SiteTreeFilterPageTypeField( )`
`public` | # `generateDataTreeHints( )`
`public` | # `generateTreeStylingJS( )`
`protected` | # `jsDeclaration( mixed $array )` Return a javascript instanciation of this array Return a javascript instanciation of this array
`public `DataObjectSet`` | # `PageTypes( )` Populates an array of classes in the CMS which allows the user to change the page type. Populates an array of classes in the CMS which allows the user to change the page type. #### Returns ``DataObjectSet`` DataObjectSet
`public `FormResponse`` | # `save_siteconfig( array $data, `Form` $form )` Save the current sites `SiteConfig` into the database Save the current sites `SiteConfig` into the database #### Parameters $data array $data $form Form $form #### Returns ``FormResponse`` FormResponse
`public` | # `getRecord( mixed $id, mixed $className = NULL )` Get a database record to be managed by the CMS Get a database record to be managed by the CMS #### Overrides `LeftAndMain::getRecord`
`public` | # `getEditForm( mixed $id )`
`public `Form`` | # `RootForm( )` #### Returns ``Form`` Form
`public` | # `addpage( )`
`public` | # `getNewItem( mixed $id, mixed $setID = true )` #### Uses ``LeftAndMainDecorator::augmentNewSiteTreeItem()``
`public` | # `deletefromlive( mixed $urlParams, mixed $form )` Delete the page from live. This means a page in draft mode might still exist. Delete the page from live. This means a page in draft mode might still exist. #### See ``CMSMain::delete()``
`public` | # `performPublish( mixed $record )` Actually perform the publication step Actually perform the publication step
`public` | # `revert( mixed $urlParams, mixed $form )` Reverts a page by publishing it to live. Use restorepage() if you want to restore a page which was deleted from draft without publishing. Reverts a page by publishing it to live. Use restorepage() if you want to restore a page which was deleted from draft without publishing. #### Uses ``SiteTree::doRevertToLive()``
`public` | # `delete( mixed $data, mixed $form )` Delete the current page from draft stage. Delete the current page from draft stage. #### See ``CMSMain::deletefromlive()``
`public` | # `SideReports( )`
`public` | # `ReportSelector( )`
`public `LiteralField`` | # `ReportFormParameters( )` Generate the parameter HTML for SideReports that have params Generate the parameter HTML for SideReports that have params #### Returns ``LiteralField`` LiteralField
`public` | # `sidereport( )` Get the content for a side report Get the content for a side report
`public` | # `versions( )` Get the versions of the current page Get the versions of the current page
`public` | # `rollback( )` Roll a page back to a previous version Roll a page back to a previous version
`public` | # `unpublish( )`
`public` | # `tellBrowserAboutPublicationChange( mixed $page, mixed $statusMessage )` Return a few pieces of information about a change to a page - Send the new status message - Update the action buttons - Update the treenote - Send a status message Return a few pieces of information about a change to a page - Send the new status message - Update the action buttons - Update the treenote - Send a status message
`public` | # `performRollback( mixed $id, mixed $version )`
`public` | # `getversion( )`
`public` | # `compareversions( )`
`public` | # `sendFormToBrowser( mixed $templateData )`
`public` | # `dialog( )`
`public` | # `canceldraftchangesdialog( )`
`public` | # `batchactions( )` Batch Actions Handler Batch Actions Handler
`public `Form`` | # `PublishItemsForm( )` #### Returns ``Form`` Form
`public` | # `BatchActionParameters( )`
`public` | # `BatchActionList( )` Returns a list of batch actions Returns a list of batch actions
`public `Form`` | # `DeleteItemsForm( )` #### Returns ``Form`` Form
`public` | # `buildbrokenlinks( )`
`public` | # `AddPageOptionsForm( )`
`public` | # `getpagecount( )` Helper function to get page count Helper function to get page count
`public` | # `publishall( )`
`public` | # `restore( )` Restore a completely deleted page from the SiteTree_versions table. Restore a completely deleted page from the SiteTree_versions table.
`public` | # `duplicate( )`
`public` | # `duplicatewithchildren( )`
`public` | # `createtranslation( )` Create a new translation from an existing item, switch to this language and reload the tree. Create a new translation from an existing item, switch to this language and reload the tree.
`public` | # `providePermissions( )` Provide the permission codes used by LeftAndMain. Can't put it on LeftAndMain since that's an abstract base class. Provide the permission codes used by LeftAndMain. Can't put it on LeftAndMain since that's an abstract base class. #### Implementation of `PermissionProvider::providePermissions()`
`public` | # `LangSelector( )` Returns all languages with languages already used appearing first. Called by the SSViewer when rendering the template. Returns all languages with languages already used appearing first. Called by the SSViewer when rendering the template.
`public boolean` | # `MultipleLanguages( )` Determine if there are more than one languages in our site tree. Determine if there are more than one languages in our site tree. #### Returns `boolean` boolean
`public boolean` | # `IsTranslatableEnabled( )` #### Returns `boolean` boolean

### Methods inherited from LeftAndMain

`ApplicationLink()`, `CMSTopMenu()`, `CMSVersion()`, `CanOrganiseSitetree()`, `EditForm()`, `EditorToolbar()`, `EmptyForm()`, `ForceReload()`, `Left()`, `LoadingImage()`, `LogoStyle()`, `MainMenu()`, `MceRoot()`, `Member_ProfileForm()`, `Right()`, `SectionTitle()`, `addTreeNodeJS()`, `ajaxupdateparent()`, `ajaxupdatesort()`, `callPageMethod()`, `canView()`, `currentPage()`, `currentPageID()`, `deleteTreeNodeJS()`, `deleteitems()`, `getActionUpdateJS()`, `getApplicationLogoText()`, `getApplicationName()`, `getLastFormIn()`, `getSiteTreeFor()`, `getTemplatesWithSuffix()`, `getitem()`, `getsubtree()`, `isCurrentPage()`, `menu_title_for_class()`, `myprofile()`, `printable()`, `require_css()`, `require_javascript()`, `require_themed_css()`, `returnItemToUser()`, `save()`, `setApplicationName()`, `setCurrentPageID()`, `setLogo()`, `set_loading_image()`, `show()`, `versionFromVersionFile()`

### Methods inherited from Controller

`CurrentMember()`, `Now()`, `PastMember()`, `PastVisitor()`, `can()`, `curr()`, `defaultAction()`, `disableBasicAuth()`, `getAction()`, `getFormOwner()`, `getRequest()`, `getResponse()`, `getSession()`, `getURLParams()`, `getViewer()`, `handleAction()`, `handleRequest()`, `hasAction()`, `hasActionTemplate()`, `has_curr()`, `isAjax()`, `join_links()`, `popCurrent()`, `pushCurrent()`, `redirect()`, `redirectBack()`, `redirectedTo()`, `render()`, `setSession()`, `setURLParams()`

### Methods inherited from RequestHandler

`__construct()`, `allowedActions()`, `checkAccessAction()`, `httpError()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `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()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### 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()`, `exists()`, `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 string` | $url_segment | #
`public static string` | $url_rule | #
`public static integer` | $url_priority | #
`public static string` | $menu_title | #
`public static integer` | $menu_priority | #
`public static string` | $tree_class | #
`public static string` | $subitem_class | #
`public static array` | $allowed_actions | # Define a list of action handling methods that are allowed to be called directly by URLs. The variable should be an array of action names. This sample shows the different values that it can contain: Define a list of action handling methods that are allowed to be called directly by URLs. The variable should be an array of action names. This sample shows the different values that it can contain:
    array(
            'someaction', // someaction can be accessed by anyone, any time
            'otheraction' => true, // So can otheraction
            'restrictedaction' => 'ADMIN', // restrictedaction can only be people with ADMIN privilege
            'complexaction' '->canComplexAction' // complexaction can only be accessed if $this->canComplexAction() returns true
    );

### Properties inherited from LeftAndMain

`$ForceReload`, `$application_link`, `$application_logo`, `$application_logo_style`, `$application_logo_text`, `$application_name`, `$extra_requirements`, `$loading_image`, `$url_base`

### Properties inherited from Controller

`$action`, `$baseInitCalled`, `$basicAuthEnabled`, `$controller_stack`, `$request`, `$requestParams`, `$response`, `$session`, `$urlParams`, `$url_handlers`

### Properties inherited from RequestHandler

`$brokenOnConstruct`

### Properties inherited from ViewableData

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

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

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