Version: current

# Class LeftAndMain

LeftAndMain is the parent class of all the two-pane views in the CMS. If you are wanting to add more areas to the CMS, you can do it by subclassing LeftAndMain.

This is essentially an abstract class which should be subclassed. See `CMSMain` for a good example.

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  Controller
  LeftAndMain

### Direct known subclasses

`AssetAdmin`, `CMSMain`, `WidgetAdmin`, `CommentAdmin`, `CustomMenuAdmin`, `DashboardAdmin`, `FaqAdmin`, `ModelAdmin`, `NewsletterAdmin`, `ReportAdmin`, `SecurityAdmin`

### Indirect known subclasses

`BookingOrderAdmin`, `CatalogAdmin`, `ProductImport1CAdmin`, `ProductImportAdmin`, `RealtyImportAdmin`, `RedirectEntry_Admin`, `RoomServiceAdmin`, `ShippingMethodAdmin`, `SubsiteAdmin`, `VAT_Admin`, `VKNotificationQueueAdmin`, `GuestbookAdmin`, `ImportCatalog1C_ProductProp_Admin`, `LoggerAdmin`, `MonumentAdmin`, `NewDocumentsAdmin`, `OrderAdmin`, `PaymentAdmin`, `PollPage`

Package: cms\core
Located at cms/code/LeftAndMain.php

## Methods summary

`public boolean` | # `canView( `Member` $member = null )` #### Parameters $member Member $member #### Returns `boolean` boolean
`public` | # `init( )` #### Uses ``LeftAndMainDecorator::init()`` ``LeftAndMainDecorator::accessedCMS()`` ``CMSMenu`` #### Overrides `Controller::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
`public string` | # `Link( mixed $action = null )` You should implement a Link() function in your subclass of LeftAndMain, to point to the URL of that particular controller. You should implement a Link() function in your subclass of LeftAndMain, to point to the URL of that particular controller. #### Returns `string` string
`public static` | # `menu_title_for_class( mixed $class )` Returns the menu title for the given LeftAndMain subclass. Implemented static so that we can get this value without instantiating an object. Menu title is not internationalised. Returns the menu title for the given LeftAndMain subclass. Implemented static so that we can get this value without instantiating an object. Menu title is not internationalised.
`public` | # `show( mixed $request )`
`public` | # `getitem( )`
`public` | # `getLastFormIn( mixed $html )`
`public `DataObjectSet`` | # `MainMenu( )` Returns the main menu of the CMS. This is also used by init() to work out which sections the user has access to. Returns the main menu of the CMS. This is also used by init() to work out which sections the user has access to. #### Returns ``DataObjectSet`` DataObjectSet
`public` | # `CMSTopMenu( )`
`protected` | # `getTemplatesWithSuffix( mixed $suffix )` Return a list of appropriate templates for this class, with the given suffix Return a list of appropriate templates for this class, with the given suffix
`public` | # `Left( )`
`public` | # `Right( )`
`public` | # `getRecord( mixed $id, mixed $className = null )`
`public` | # `getSiteTreeFor( mixed $className, mixed $rootID = null, mixed $childrenMethod = null, mixed $numChildrenMethod = null, mixed $filterFunction = null, mixed $minNodeCount = 30 )` Get a site tree displaying the nodes under the given objects Get a site tree displaying the nodes under the given objects #### Parameters $className $className The class of the root object $rootID $rootID The ID of the root object. If this is null then a complete tree will be shown $childrenMethod $childrenMethod The method to call to get the children of the tree. For example, Children, AllChildrenIncludingDeleted, or AllHistoricalChildren $numChildrenMethod $filterFunction $minNodeCount
`public` | # `getsubtree( mixed $request )` Get a subtree underneath the request param 'ID'. If ID = 0, then get the whole tree. Get a subtree underneath the request param 'ID'. If ID = 0, then get the whole tree.
`public` | # `returnItemToUser( mixed $p )` Allows you to returns a new data object to the tree (subclass of sitetree) and updates the tree via javascript. Allows you to returns a new data object to the tree (subclass of sitetree) and updates the tree via javascript.
`public` | # `save( mixed $urlParams, mixed $form )` Save and Publish page handler Save and Publish page handler
`public string` | # `getActionUpdateJS( mixed $record )` Returns a javascript snippet that will update the actions of the main form Returns a javascript snippet that will update the actions of the main form #### Returns `string` string
`public string` | # `addTreeNodeJS( mixed $page, mixed $select = false )` Returns a javascript snippet to generate a tree node for the given page, if visible Returns a javascript snippet to generate a tree node for the given page, if visible #### Returns `string` string
`public string` | # `deleteTreeNodeJS( mixed $page )` Returns a javascript snippet to remove a tree node for the given page, if it exists. Returns a javascript snippet to remove a tree node for the given page, if it exists. #### Returns `string` string
`public static` | # `ForceReload( )` Sets a static variable on this class which means the panel will be reloaded. Sets a static variable on this class which means the panel will be reloaded.
`public` | # `ajaxupdateparent( )` Ajax handler for updating the parent of a tree node Ajax handler for updating the parent of a tree node
`public` | # `ajaxupdatesort( )` Ajax handler for updating the order of a number of tree nodes $_GET[ID]: An array of node ids in the correct order $_GET[MovedNodeID]: The node that actually got moved Ajax handler for updating the order of a number of tree nodes $_GET[ID]: An array of node ids in the correct order $_GET[MovedNodeID]: The node that actually got moved
`public` | # `CanOrganiseSitetree( )`
`public` | # `deleteitems( )` Delete a number of items Delete a number of items
`public `Form`` | # `EmptyForm( )` Returns a placeholder form, used by getEditForm() if no record is selected. Our javascript logic always requires a form to be present in the CMS interface. Returns a placeholder form, used by getEditForm() if no record is selected. Our javascript logic always requires a form to be present in the CMS interface. #### Returns ``Form`` Form
`public` | # `EditForm( )`
`public` | # `myprofile( )`
`public` | # `Member_ProfileForm( )`
`public` | # `printable( )`
`public` | # `currentPageID( )`
`public` | # `setCurrentPageID( mixed $id )`
`public` | # `currentPage( )`
`public` | # `isCurrentPage( `DataObject` $page )`
`public` | # `EditorToolbar( )` Return the CMS's HTML-editor toolbar Return the CMS's HTML-editor toolbar
`public string` | # `CMSVersion( )` Return the version number of this application. Uses the subversion path information in <mymodule>/silverstripe_version (automacially replaced $URL$ placeholder). Return the version number of this application. Uses the subversion path information in <mymodule>/silverstripe_version (automacially replaced $URL$ placeholder). #### Returns `string` string
`public` | # `versionFromVersionFile( mixed $fileContent )` Return the version from the content of a silverstripe_version file Return the version from the content of a silverstripe_version file
`public array` | # `SwitchView( )` #### Returns `array` array
`public static` | # `setApplicationName( mixed $name, mixed $logoText = null, mixed $link = null )`
`public String` | # `getApplicationName( )` Get the application name. Get the application name. #### Returns `String` String
`public String` | # `getApplicationLogoText( )` Get the application logo text. Get the application logo text. #### Returns `String` String
`public` | # `ApplicationLink( )`
`public` | # `SectionTitle( )` Return the title of the current section, as shown on the main menu Return the title of the current section, as shown on the main menu
`public static` | # `setLogo( String $logo, String $logoStyle )` Set the CMS application logo. Set the CMS application logo. #### Parameters $logo String $logo Relative path to the logo $logoStyle String $logoStyle Custom CSS styles for the logo e.g. "border: 1px solid red; padding: 5px;"
`public static` | # `set_loading_image( mixed $loadingImage )` Set the image shown when the CMS is loading. Set the image shown when the CMS is loading.
`public` | # `LoadingImage( )`
`public` | # `LogoStyle( )`
`public` | # `MceRoot( )` Return the base directory of the tiny_mce codebase Return the base directory of the tiny_mce codebase
`public` | # `callPageMethod( mixed $data, mixed $form )` Use this as an action handler for custom CMS buttons. Use this as an action handler for custom CMS buttons.
`public static` | # `require_javascript( mixed $file )` Register the given javascript file as required in the CMS. Filenames should be relative to the base, eg, SAPPHIRE_DIR . '/javascript/loader.js' Register the given javascript file as required in the CMS. Filenames should be relative to the base, eg, SAPPHIRE_DIR . '/javascript/loader.js'
`public static` | # `require_css( mixed $file, mixed $media = null )` Register the given stylesheet file as required. Register the given stylesheet file as required. #### Parameters $file $file String Filenames should be relative to the base, eg, THIRDPARTY_DIR . '/tree/tree.css' $media $media String Comma-separated list of media-types (e.g. "screen,projector") #### See http://www.w3.org/TR/REC-CSS2/media.html
`public static` | # `require_themed_css( mixed $name, mixed $media = null )` Register the given "themeable stylesheet" as required. Themeable stylesheets have globally unique names, just like templates and PHP files. Because of this, they can be replaced by similarly named CSS files in the theme directory. Register the given "themeable stylesheet" as required. Themeable stylesheets have globally unique names, just like templates and PHP files. Because of this, they can be replaced by similarly named CSS files in the theme directory. #### Parameters $name $name String The identifier of the file. For example, css/MyFile.css would have the identifier "MyFile" $media $media String Comma-separated list of media-types (e.g. "screen,projector")

### 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_base | # The 'base' url for CMS administration areas. Note that if this is changed, many javascript behaviours need to be updated with the correct url The 'base' url for CMS administration areas. Note that if this is changed, many javascript behaviours need to be updated with the correct url
`public static mixed` | $url_segment | #
`public static string` | $url_rule | #
`public static mixed` | $menu_title | #
`public static integer` | $menu_priority | #
`public static integer` | $url_priority | #
`public static mixed` | $tree_class | #
`public static mixed` | $ForceReload | #
`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
    );
`protected static array` | $extra_requirements | # Register additional requirements through the Requirements class. Used mainly to work around the missing "lazy loading" functionality for getting css/javascript required after an ajax-call (e.g. loading the editform). Register additional requirements through the Requirements class. Used mainly to work around the missing "lazy loading" functionality for getting css/javascript required after an ajax-call (e.g. loading the editform).
`public static String` | $application_name | # The application name. Customisable by calling LeftAndMain::setApplicationName() - the first parameter. The application name. Customisable by calling LeftAndMain::setApplicationName() - the first parameter.
`public static String` | $application_logo_text | # The application logo text. Customisable by calling LeftAndMain::setApplicationName() - the second parameter. The application logo text. Customisable by calling LeftAndMain::setApplicationName() - the second parameter.
`public static string` | $application_link | # Set the application name, and the logo text. Set the application name, and the logo text. #### Param String $name The application name String $logoText The logo text
`public static unknown_type` | $application_logo | # The application logo path. Customisable by calling LeftAndMain::setLogo() - the first parameter. The application logo path. Customisable by calling LeftAndMain::setLogo() - the first parameter.
`public static String` | $application_logo_style | # The application logo style. Customisable by calling LeftAndMain::setLogo() - the second parameter. The application logo style. Customisable by calling LeftAndMain::setLogo() - the second parameter.
`protected static string` | $loading_image | #

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