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.
Public Properties ​
Property | Description |
---|---|
action | string, null – The form action. |
actionMenuItems | callable, null – Action menu items factory. |
additionalButtonsHtml | string, callable, null – Additional buttons’ HTML. |
altActions | array, callable, null – Alternate form actions. |
contentHtml | string, callable, null – The content HTML. |
contextMenuItems | callable, null – Context menu items factory. |
crumbs | array, callable, null – Breadcrumbs. |
docTitle | string, null – The document title. |
editUrl | string, null – The control panel edit URL for this screen. |
errorSummary | string, callable, null – The errors summary HTML (DEV-212). |
formAttributes | array – Custom attributes to add to the <form> tag. |
mainAttributes | array – Custom attributes to add to the <main> tag. |
metaSidebarHtml | string, callable, null – The right-hand meta sidebar HTML. |
noticeHtml | string, callable, null – The content notice HTML. |
owner | craft\web\Response |
pageSidebarHtml | string, callable, null – The left-hand page sidebar HTML (only used by full-page screens). |
prepareScreen | callable, null – Callable that will be called before other properties are added to the screen. |
redirectUrl | string, null – The URL the form should redirect to after posting. |
saveShortcutRedirectUrl | string, null – The URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut. |
selectableSites | `(\craft\models\Site |
selectedSubnavItem | string, null – The selected subnav item’s key in the global sidebar. |
site | craft\models\Site, null – The site that should be displayed within the breadcrumbs. |
slideoutBodyClass | string, null – Class that should be added to the slideout body. |
submitButtonLabel | string, null – The submit button label. |
tabs | array – Tabs. |
title | string, null – The page title. |
action
​
The form action.
See also action()
actionMenuItems
​
Action menu items factory.
See also actionMenuItems()
additionalButtonsHtml
​
Additional buttons’ HTML.
This will only be used by full-page screens.
See also:
altActions
​
Alternate form actions.
This will only be used by full-page screens.
See also:
contentHtml
​
The content HTML.
See also:
contextMenuItems
​
Context menu items factory.
See also contextMenuItems()
crumbs
​
Breadcrumbs.
This will only be used by full-page screens.
See also:
docTitle
​
The document title. If null, title() will be used.
This will only be used by full-page screens.
See also docTitle()
editUrl
​
The control panel edit URL for this screen.
See also editUrl()
errorSummary
​
The errors summary HTML (DEV-212).
See also:
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()
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()
metaSidebarHtml
​
The right-hand meta sidebar HTML.
See also:
noticeHtml
​
The content notice HTML.
See also:
owner
​
- Type
- craft\web\Response
- Default value
null
pageSidebarHtml
​
The left-hand page sidebar HTML (only used by full-page screens).
See also:
prepareScreen
​
Callable that will be called before other properties are added to the screen.
See also prepareScreen()
redirectUrl
​
The URL the form should redirect to after posting.
This will only be used by full-page screens.
See also redirectUrl()
saveShortcutRedirectUrl
​
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()
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()
selectedSubnavItem
​
The selected subnav item’s key in the global sidebar.
This will only be used by full-page screens.
See also selectedSubnavItem()
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()
slideoutBodyClass
​
Class that should be added to the slideout body.
submitButtonLabel
​
The submit button label.
See also submitButtonLabel()
tabs
​
- Type
- array
- Default value
[]
Tabs.
See also:
title
​
The page title.
This will only be used by full-page screens.
See also title()
Public Methods ​
Method | Description |
---|---|
__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.
Arguments ​
Returns ​
actionMenuItems()
​
- Since
- 5.0.0
Sets the action menu items.
See craft\helpers\Cp::disclosureMenu() for documentation on supported item properties.
Arguments ​
Returns ​
addAltAction()
​
Adds an alternate form action.
This will only be used by full-page screens.
See also altActions()View source
Arguments ​
Returns ​
addCrumb()
​
Adds a breadcrumb.
This will only be used by full-page screens.
Arguments ​
Returns ​
addTab()
​
Adds a tab.
Arguments ​
Returns ​
additionalButtonsHtml()
​
- Since
- 5.0.0
Sets the additional buttons’ HTML.
This will only be used by full-page screens.
Arguments ​
Returns ​
additionalButtonsTemplate()
​
Sets a template that should be used to render the additional buttons’ HTML.
This will only be used by full-page screens.
Arguments ​
Returns ​
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 tofalse
).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 JavaScriptsubmit
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.
Arguments ​
Returns ​
contentHtml()
​
- Since
- 5.0.0
Sets the content HTML.
Arguments ​
Returns ​
contentTemplate()
​
Sets a template that should be used to render the content HTML.
Arguments ​
Returns ​
contextMenuItems()
​
- Since
- 5.0.0
Sets the context menu items.
See craft\helpers\Cp::disclosureMenu() for documentation on supported item properties.
Arguments ​
Returns ​
crumbs()
​
Sets the breadcrumbs.
Breadcrumbs should be defined by arrays with the following keys:
label
– The breadcrumb label, to be HTML-encodedurl
– The URL that the breadcrumb should link toicon
– The icon which should be displayed beside the labelmenu
– 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.
Arguments ​
Returns ​
docTitle()
​
Sets the document title.
This will only be used by full-page screens.
Arguments ​
Returns ​
editUrl()
​
Sets the control panel edit URL for this screen.
Arguments ​
Returns ​
errorSummary()
​
- Since
- 4.5.0
Sets the errors summary HTML.
Arguments ​
Returns ​
errorSummaryTemplate()
​
- Since
- 4.5.0
Sets a template that should be used to render the errors summary HTML.
Arguments ​
Returns ​
formAttributes()
​
Sets custom attributes that should be added to the <form>
tag.
See yii\helpers\BaseHtml::renderTagAttributes() for supported attribute syntaxes.
Arguments ​
$value
(array)
Returns ​
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.
Arguments ​
$value
(array)
Returns ​
metaSidebarHtml()
​
- Since
- 5.0.0
Sets the right-hand meta sidebar HTML.
Arguments ​
Returns ​
metaSidebarTemplate()
​
Sets a template that should be used to render the right-hand meta sidebar HTML.
Arguments ​
Returns ​
noticeHtml()
​
- Since
- 5.0.0
Sets the content notice HTML.
Arguments ​
Returns ​
noticeTemplate()
​
Sets a template that should be used to render the content notice HTML.
Arguments ​
Returns ​
pageSidebarHtml()
​
- Since
- 5.0.0
Sets the left-hand page sidebar HTML (only used by full-page screens).
Arguments ​
Returns ​
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).
Arguments ​
Returns ​
prepareScreen()
​
Sets a callable that will be called before other properties are added to the screen.
Arguments ​
Returns ​
redirectUrl()
​
Sets the URL the form should redirect to after posting.
This will only be used by full-page screens.
Arguments ​
Returns ​
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.
Arguments ​
Returns ​
selectableSites()
​
- Since
- 5.0.0
Sets the sites that should be selectable by the site breadcrumb menu.
Arguments ​
$value
((\craft\models\Site|array{site: \craft\models\Site, status?: string})[]
, null)
Returns ​
selectedSubnavItem()
​
Sets the selected subnav item’s key in the global sidebar.
This will only be used by full-page screens.
Arguments ​
Returns ​
site()
​
- Since
- 5.0.0
Sets the site that should be displayed within the breadcrumbs.
Arguments ​
$value
(craft\models\Site, null)
Returns ​
submitButtonLabel()
​
Sets the submit button label.
Arguments ​
Returns ​
tabs()
​
Sets the tabs.
Each tab should be represented by a nested array with the following keys:
label
– The human-facing tab label.url
– Thehref
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 totrue
).
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.
Arguments ​
$value
(array)
Returns ​
title()
​
Sets the page title.
This will only be used by full-page screens.
Arguments ​
Returns ​
Constants ​
Constant | Description |
---|---|
NAME |