SilverStripe\Admin\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 for a good example.
Synopsis
class LeftAndMain
extends Controller
implements
PermissionProvider
{
- // constants
- const SCHEMA_HEADER = 'X-Formschema-Request';
- // members
- private static bool $client_debugging = true;
- private static $url_segment = NULL;
- private static string $url_rule = '/$Action/$ID/$OtherID';
- private static $menu_title;
- private static $menu_icon;
- private static integer $menu_priority = 0;
- private static integer $url_priority = 50;
- private static $tree_class = NULL;
- private static string $help_link = '';
- private static array $allowed_actions = ;
- private static array $url_handlers = ;
- private static array $dependencies = ;
- protected FormSchema $schema = NULL;
- protected $pageID = NULL;
- private static array $admin_themes = ;
- private static $required_permission_codes;
- private static $session_namespace;
- private static array $extra_requirements_javascript = ;
- private static array $extra_requirements_css = ;
- private static array $extra_requirements_themedCss = ;
- private static bool $session_keepalive_ping = true;
- private static string $frame_options = 'SAMEORIGIN';
- private static string|null $section_name = NULL;
- protected PjaxResponseNegotiator $responseNegotiator;
- protected VersionProvider $versionProvider;
- protected LeftAndMain_SearchFilter $searchFilterCache = NULL;
- private static array $help_links = ;
- private static string $application_link = '//www.silverstripe.org/';
- private static string $application_name = 'Silverstripe';
- // methods
- public string getCombinedClientConfig()
- public array getClientConfig()
- public FormSchema getFormSchema()
- public $this setFormSchema()
- public HTTPResponse schema()
- public HTTPResponse jsonError()
- public HTTPResponse methodSchema()
- protected bool getSchemaRequested()
- protected HTTPResponse getSchemaResponse()
- public bool canView()
- public static array|string|bool getRequiredPermissions()
- protected void init()
- public void handleRequest()
- public HTTPResponse|string redirect()
- public HTTPResponse index()
- public bool ShowSwitchView()
- public string Link()
- public static void menu_title_for_class()
- public static string menu_title()
- public static string menu_icon_for_class()
- public static string menu_icon_class_for_class()
- public HTTPResponse show()
- public PjaxResponseNegotiator getResponseNegotiator()
- public SS_List MainMenu()
- public void Menu()
- public ArrayData MenuCurrentItem()
- public string|array getTemplatesWithSuffix()
- public void Content()
- public DBHTMLText PreviewPanel()
- public DataObject getRecord()
- public ArrayList Breadcrumbs()
- protected LeftAndMain_SearchFilter getSearchFilter()
- public HTTPResponse save()
- public DataObject getNewItem()
- public void delete()
- public Form EditForm()
- public Form getEditForm()
- public Form EmptyForm()
- public ModalController Modals()
- public string Tools()
- public string EditFormTools()
- public void batchactions()
- public Form BatchActionsForm()
- public void printable()
- public DBHTMLText getSilverStripeNavigator()
- public int currentPageID()
- public void setCurrentPageID()
- public DataObject currentPage()
- public bool isCurrentPage()
- protected string sessionNamespace()
- public string|bool LinkPreview()
- public string CMSVersion()
- public string CMSVersionNumber()
- public array SwitchView()
- public SiteConfig SiteConfig()
- public ArrayList getHelpLinks()
- public string ApplicationLink()
- public string getApplicationName()
- public string Title()
- public string SectionTitle()
- public string LogoutURL()
- public string BaseCSSClasses()
- public string Locale()
- public void providePermissions()
- public $this setVersionProvider()
- public VersionProvider getVersionProvider()
Hierarchy
Extends
- SilverStripe\Control\Controller
Implements
- SilverStripe\Security\PermissionProvider
Tasks
Line | Task |
---|---|
964 | Necessary for TableListField URLs to work properly |
1117+ | Wrap in CMSMenu instance accessor |
Constants
Name | Value |
---|---|
SCHEMA_HEADER | 'X-Formschema-Request' |
Members
private
- $admin_themes
—
array
Assign themes to use for cms - $allowed_actions — array
- $application_link
—
string
The href for the anchor on the Silverstripe logo - $application_name
—
string
The application name - $client_debugging
—
SilverStripe\Admin\bool
Enable front-end debugging (increases verbosity) in dev mode. - $dependencies
- $extra_requirements_css
—
array
YAML configuration example: <code> LeftAndMain: extra_requirements_css: mysite/css/mystyle.css: media: screen </code> - $extra_requirements_javascript
—
array
Register additional requirements through the {@link Requirements} class. - $extra_requirements_themedCss — array
- $frame_options
—
string
Value of X-Frame-Options header - $help_link — string
- $help_links
—
array
The urls used for the links in the Help dropdown in the backend - $required_permission_codes
—
array
Codes which are required from the current user to view this controller. - $section_name
—
SilverStripe\Admin\string|null
The configuration passed to the supporting JS for each CMS section includes a 'name' key that by default matches the FQCN of the current class. This setting allows you to change the key if necessary (for example, if you are overloading CMSMain or another core class and want to keep the core JS - which depends on the core class names - functioning, you would need to set this to the FQCN of the class you are overloading). - $session_keepalive_ping
—
SilverStripe\Admin\bool
If true, call a keepalive ping every 5 minutes from the CMS interface, to ensure that the session never dies. - $session_namespace
—
string
Namespace for session info, e.g. current record. - $tree_class
—
string
A subclass of {@link DataObject}. - $url_handlers
- $url_priority — int
- $url_rule — string
- $url_segment
—
string
The current url segment attached to the LeftAndMain instance
protected
- $pageID
—
null
Current pageID for this request - $responseNegotiator — SilverStripe\Control\PjaxResponseNegotiator
- $schema
—
SilverStripe\Forms\Schema\FormSchema
Current form schema helper - $searchFilterCache
—
SilverStripe\Admin\LeftAndMain_SearchFilter
Cached search filter instance for current search - $versionProvider — SilverStripe\Core\Manifest\VersionProvider
Methods
protected
- getSchemaRequested() — Check if the current request has a X-Formschema-Request header set.
- getSchemaResponse() — Generate schema for the given form based on the X-Formschema-Request header value
- getSearchFilter() — Gets the current search filter for this request, if available
- init()
- sessionNamespace()
public
- ApplicationLink()
- BaseCSSClasses() — Same as {@link ViewableData->CSSClasses()}, but with a changed name to avoid problems when using {@link ViewableData->customise()} (which always returns "ArrayData" from the $original object).
- BatchActionsForm()
- Breadcrumbs()
- CMSVersion() — Return the version number of this application, ie. 'CMS: 4.2.1'
- CMSVersionNumber() — Return the version number of the CMS in the 'major.minor' format, e.g. '4.2' Will handle 4.10.x-dev by removing .x-dev
- Content()
- EditForm() — Retrieves an edit form, either for display, or to process submitted data.
- EditFormTools() — Renders a panel containing tools which apply to the currently displayed edit form.
- EmptyForm() — Returns a placeholder form, used by {@link getEditForm()} if no record is selected.
- Link() — You should implement a Link() function in your subclass of LeftAndMain, to point to the URL of that particular controller.
- LinkPreview() — URL to a previewable record which is shown through this controller.
- Locale()
- LogoutURL() — Generate a logout url with BackURL to the CMS
- MainMenu() — Returns the main menu of the CMS. This is also used by init() to work out which sections the user has access to.
- Menu()
- MenuCurrentItem()
- Modals() — Handler for all global modals
- PreviewPanel() — Render $PreviewPanel content
- SectionTitle() — Return the title of the current section. Either this is pulled from the current panel's menu_title or from the first active menu
- ShowSwitchView() — If this is set to true, the "switchView" context in the template is shown, with links to the staging and publish site.
- SiteConfig()
- SwitchView()
- Title()
- Tools() — Renders a panel containing tools which apply to all displayed "content" (mostly through {@link EditForm()}), for example a tree navigation or a filter panel.
- batchactions() — Batch Actions Handler
- canView()
- currentPage() — Uses {@link getRecord()} and {@link currentPageID()} to get the currently selected record.
- currentPageID() — Identifier for the currently shown record, in most cases a database ID. Inspects the following sources (in this order): - GET/POST parameter named 'ID' - URL parameter named 'ID' - Session value namespaced by classname, e.g. "CMSMain.currentPage"
- delete()
- getApplicationName() — Get the application name.
- getClientConfig() — Returns configuration required by the client app.
- getCombinedClientConfig() — Gets the combined configuration of all LeftAndMain subclasses required by the client app.
- getEditForm() — Calls {@link SiteTree->getCMSFields()} by default to determine the form fields to display.
- getFormSchema() — Get form schema helper
- getHelpLinks() — Returns help_links in a format readable by a template
- getNewItem() — Create new item.
- getRecord() — Get dataobject from the current ID
- getRequiredPermissions() — Get list of required permissions
- getResponseNegotiator() — Caution: Volatile API.
- getTemplatesWithSuffix() — Return appropriate template(s) for this class, with the given suffix using {@link SSViewer::get_templates_by_class()}
- getVersionProvider() — Get the SilverStripe version provider
- handleRequest()
- index()
- isCurrentPage() — Compares a given record to the currently selected one (if any).
- jsonError() — Return an error HTTPResponse encoded as json
- methodSchema()
- printable()
- providePermissions()
- redirect() — Overloaded redirection logic to trigger a fake redirect on ajax requests.
- save() — Save handler
- schema() — Gets a JSON schema representing the current edit form.
- setCurrentPageID() — Forces the current page to be set in session, which can be retrieved later through {@link currentPageID()}.
- setFormSchema() — Set form schema helper for this controller
- setVersionProvider() — Set the SilverStripe version provider to use
- show()