Skip to content

CpScreenResponseBehavior

Type
Class
Namespace
craft\web
Inherits
craft\web\CpScreenResponseBehavior » yii\base\Behavior » yii\base\BaseObject
Implements
yii\base\Configurable
Since
4.0.0

Control panel screen response behavior.

View source

Public Properties

PropertyDescription
actionstring, null – The form action.
actionMenuItemscallable, null – Action menu items factory.
additionalButtonsHtmlstring, callable, null – Additional buttons’ HTML.
altActionsarray, callable, null – Alternate form actions.
contentHtmlstring, callable, null – The content HTML.
contextMenuItemscallable, null – Context menu items factory.
crumbsarray, callable, null – Breadcrumbs.
docTitlestring, null – The document title.
editUrlstring, null – The control panel edit URL for this screen.
errorSummarystring, callable, null – The errors summary HTML (DEV-212).
formAttributesarray – Custom attributes to add to the <form> tag.
mainAttributesarray – Custom attributes to add to the <main> tag.
metaSidebarHtmlstring, callable, null – The right-hand meta sidebar HTML.
noticeHtmlstring, callable, null – The content notice HTML.
ownercraft\web\Response
pageSidebarHtmlstring, callable, null – The left-hand page sidebar HTML (only used by full-page screens).
prepareScreencallable, null – Callable that will be called before other properties are added to the screen.
redirectUrlstring, null – The URL the form should redirect to after posting.
saveShortcutRedirectUrlstring, null – The URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut.
selectableSites`(\craft\models\Site
selectedSubnavItemstring, null – The selected subnav item’s key in the global sidebar.
sitecraft\models\Site, null – The site that should be displayed within the breadcrumbs.
slideoutBodyClassstring, null – Class that should be added to the slideout body.
submitButtonLabelstring, null – The submit button label.
tabsarray – Tabs.
titlestring, null – The page title.

action

Type
string, null
Default value
null

The form action.

See also action()

View source

actionMenuItems

Type
callable, null
Default value
null
Since
5.0.0

Action menu items factory.

See also actionMenuItems()

View source

additionalButtonsHtml

Type
string, callable, null
Default value
null
Since
5.0.0

Additional buttons’ HTML.

This will only be used by full-page screens.

See also:

View source

altActions

Type
array, callable, null
Default value
null

Alternate form actions.

This will only be used by full-page screens.

See also:

View source

contentHtml

Type
string, callable, null
Default value
null
Since
5.0.0

The content HTML.

See also:

View source

contextMenuItems

Type
callable, null
Default value
null
Since
5.0.0

Context menu items factory.

See also contextMenuItems()

View source

crumbs

Type
array, callable, null
Default value
null

Breadcrumbs.

This will only be used by full-page screens.

See also:

View source

docTitle

Type
string, null
Default value
null

The document title. If null, title() will be used.

This will only be used by full-page screens.

See also docTitle()

View source

editUrl

Type
string, null
Default value
null

The control panel edit URL for this screen.

See also editUrl()

View source

errorSummary

Type
string, callable, null
Default value
null
Since
4.5.0

The errors summary HTML (DEV-212).

See also:

View source

formAttributes

Type
array
Default value
[]

Custom attributes to add to the <form> tag.

See yii\helpers\BaseHtml::renderTagAttributes() for supported attribute syntaxes.

See also formAttributes()

View source

mainAttributes

Type
array
Default value
[]

Custom attributes to add to the <main> tag.

See yii\helpers\BaseHtml::renderTagAttributes() for supported attribute syntaxes.

This will only be used by full-page screens.

See also mainAttributes()

View source

metaSidebarHtml

Type
string, callable, null
Default value
null
Since
5.0.0

The right-hand meta sidebar HTML.

See also:

View source

noticeHtml

Type
string, callable, null
Default value
null
Since
5.0.0

The content notice HTML.

See also:

View source

owner

Type
craft\web\Response
Default value
null

View source

pageSidebarHtml

Type
string, callable, null
Default value
null
Since
5.0.0

The left-hand page sidebar HTML (only used by full-page screens).

See also:

View source

prepareScreen

Type
callable, null
Default value
null

Callable that will be called before other properties are added to the screen.

See also prepareScreen()

View source

redirectUrl

Type
string, null
Default value
null

The URL the form should redirect to after posting.

This will only be used by full-page screens.

See also redirectUrl()

View source

saveShortcutRedirectUrl

Type
string, null
Default value
null

The URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut.

This will only be used by full-page screens.

See also saveShortcutRedirectUrl()

View source

selectableSites

Type
(\craft\models\Site|array{site: \craft\models\Site, status?: string})[], null
Default value
null
Since
5.0.0

The sites that should be selectable by the site breadcrumb menu.

See also selectableSites()

View source

selectedSubnavItem

Type
string, null
Default value
null

The selected subnav item’s key in the global sidebar.

This will only be used by full-page screens.

See also selectedSubnavItem()

View source

site

Type
craft\models\Site, null
Default value
null
Since
5.0.0

The site that should be displayed within the breadcrumbs.

See also site()

View source

slideoutBodyClass

Type
string, null
Default value
null
Since
4.5.0

Class that should be added to the slideout body.

View source

submitButtonLabel

Type
string, null
Default value
null

The submit button label.

See also submitButtonLabel()

View source

tabs

Type
array
Default value
[]

Tabs.

See also:

View source

title

Type
string, null
Default value
null

The page title.

This will only be used by full-page screens.

See also title()

View source

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__construct()Constructor.
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to null.
action()Sets the form action.
actionMenuItems()Sets the action menu items.
addAltAction()Adds an alternate form action.
addCrumb()Adds a breadcrumb.
addTab()Adds a tab.
additionalButtonsHtml()Sets the additional buttons’ HTML.
additionalButtonsTemplate()Sets a template that should be used to render the additional buttons’ HTML.
altActions()Sets alternate form actions.
attach()Attaches the behavior object to the component.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
contentHtml()Sets the content HTML.
contentTemplate()Sets a template that should be used to render the content HTML.
contextMenuItems()Sets the context menu items.
crumbs()Sets the breadcrumbs.
detach()Detaches the behavior object from the component.
docTitle()Sets the document title.
editUrl()Sets the control panel edit URL for this screen.
errorSummary()Sets the errors summary HTML.
errorSummaryTemplate()Sets a template that should be used to render the errors summary HTML.
events()Declares event handlers for the owner's events.
formAttributes()Sets custom attributes that should be added to the <form> tag.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.
mainAttributes()Sets custom attributes that should be added to the <main> tag.
metaSidebarHtml()Sets the right-hand meta sidebar HTML.
metaSidebarTemplate()Sets a template that should be used to render the right-hand meta sidebar HTML.
noticeHtml()Sets the content notice HTML.
noticeTemplate()Sets a template that should be used to render the content notice HTML.
pageSidebarHtml()Sets the left-hand page sidebar HTML (only used by full-page screens).
pageSidebarTemplate()Sets a template that should be used to render the left-hand page sidebar HTML (only used by full-page screens).
prepareScreen()Sets a callable that will be called before other properties are added to the screen.
redirectUrl()Sets the URL the form should redirect to after posting.
saveShortcutRedirectUrl()Sets URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut.
selectableSites()Sets the sites that should be selectable by the site breadcrumb menu.
selectedSubnavItem()Sets the selected subnav item’s key in the global sidebar.
site()Sets the site that should be displayed within the breadcrumbs.
submitButtonLabel()Sets the submit button label.
tabs()Sets the tabs.
title()Sets the page title.

action()

Sets the form action.

View source

Arguments

Returns

craft\web\Response

actionMenuItems()

Since
5.0.0

Sets the action menu items.

See craft\helpers\Cp::disclosureMenu() for documentation on supported item properties.

View source

Arguments

  • $value (callable, null) – A callback function which returns the menu items

Returns

craft\web\Response

addAltAction()

Adds an alternate form action.

This will only be used by full-page screens.

See also altActions()View source

Arguments

Returns

craft\web\Response

addCrumb()

Adds a breadcrumb.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

addTab()

Adds a tab.

View source

Arguments

Returns

craft\web\Response

additionalButtonsHtml()

Since
5.0.0

Sets the additional buttons’ HTML.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

additionalButtonsTemplate()

Sets a template that should be used to render the additional buttons’ HTML.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

altActions()

Sets alternate form actions.

Each action should be represented by a nested array with the following keys:

  • label – The human-facing action label.
  • destructive (optional) – Whether the action should be considered destructive (defaults to false).
  • action (optional) – The controller action that should be posted to.
  • redirect (optional) – The URL the form should redirect to afterwards.
  • confirm (optional) – A confirmation message that should be shown.
  • params (optional) – Array of additional params that should be posted.
  • eventData (optional) – Additional properties that should be assigned to the JavaScript submit event.
  • shortcut (optional) – Whether the action can be triggered with a Command/Ctrl + S keyboard shortcut (or Command/Ctrl + Shift + S if 'shift' => true is also set).
  • retainScroll (optional) – Whether the browser should retain its scroll position on the next page.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

contentHtml()

Since
5.0.0

Sets the content HTML.

View source

Arguments

Returns

craft\web\Response

contentTemplate()

Sets a template that should be used to render the content HTML.

View source

Arguments

Returns

craft\web\Response

contextMenuItems()

Since
5.0.0

Sets the context menu items.

See craft\helpers\Cp::disclosureMenu() for documentation on supported item properties.

View source

Arguments

  • $value (callable, null) – A callback function which returns the menu items

Returns

craft\web\Response

crumbs()

Sets the breadcrumbs.

Breadcrumbs should be defined by arrays with the following keys:

  • label – The breadcrumb label, to be HTML-encoded
  • url – The URL that the breadcrumb should link to
  • icon – The icon which should be displayed beside the label
  • menu – The menu items which should be displayed alongside the breadcrumb (see craft\helpers\Cp::disclosureMenu() for documentation on supported item properties)
  • current – Whether the breadcrumb represents the current page

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

docTitle()

Sets the document title.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

editUrl()

Sets the control panel edit URL for this screen.

View source

Arguments

Returns

craft\web\Response

errorSummary()

Since
4.5.0

Sets the errors summary HTML.

View source

Arguments

Returns

craft\web\Response

errorSummaryTemplate()

Since
4.5.0

Sets a template that should be used to render the errors summary HTML.

View source

Arguments

Returns

craft\web\Response

formAttributes()

Sets custom attributes that should be added to the <form> tag.

See yii\helpers\BaseHtml::renderTagAttributes() for supported attribute syntaxes.

View source

Arguments

Returns

craft\web\Response

mainAttributes()

Sets custom attributes that should be added to the <main> tag.

See yii\helpers\BaseHtml::renderTagAttributes() for supported attribute syntaxes.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

metaSidebarHtml()

Since
5.0.0

Sets the right-hand meta sidebar HTML.

View source

Arguments

Returns

craft\web\Response

metaSidebarTemplate()

Sets a template that should be used to render the right-hand meta sidebar HTML.

View source

Arguments

Returns

craft\web\Response

noticeHtml()

Since
5.0.0

Sets the content notice HTML.

View source

Arguments

Returns

craft\web\Response

noticeTemplate()

Sets a template that should be used to render the content notice HTML.

View source

Arguments

Returns

craft\web\Response

pageSidebarHtml()

Since
5.0.0

Sets the left-hand page sidebar HTML (only used by full-page screens).

View source

Arguments

Returns

craft\web\Response

pageSidebarTemplate()

Since
4.5.0

Sets a template that should be used to render the left-hand page sidebar HTML (only used by full-page screens).

View source

Arguments

Returns

craft\web\Response

prepareScreen()

Sets a callable that will be called before other properties are added to the screen.

View source

Arguments

Returns

craft\web\Response

redirectUrl()

Sets the URL the form should redirect to after posting.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

saveShortcutRedirectUrl()

Sets URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

selectableSites()

Since
5.0.0

Sets the sites that should be selectable by the site breadcrumb menu.

View source

Arguments

  • $value ((\craft\models\Site|array{site: \craft\models\Site, status?: string})[], null)

Returns

craft\web\Response

selectedSubnavItem()

Sets the selected subnav item’s key in the global sidebar.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

site()

Since
5.0.0

Sets the site that should be displayed within the breadcrumbs.

View source

Arguments

Returns

craft\web\Response

submitButtonLabel()

Sets the submit button label.

View source

Arguments

Returns

craft\web\Response

tabs()

Sets the tabs.

Each tab should be represented by a nested array with the following keys:

  • label – The human-facing tab label.
  • url – The href attribute of the tab’s anchor. Set to #container-ids if the tabs are meant to toggle in-page content.
  • class (optional) - Class name(s) that should be added to the tab’s anchor.
  • visible (optional) – Whether the tab should be initially visible (defaults to true).

If the tabs are meant to toggle in-page content, the array keys should be set to the id attributes of the container elements they represent.

View source

Arguments

Returns

craft\web\Response

title()

Sets the page title.

This will only be used by full-page screens.

View source

Arguments

Returns

craft\web\Response

Constants

ConstantDescription
NAME