CpScreenResponseBehavior

Type
Class
Namespace
craft\web
Inherits
craft\web\CpScreenResponseBehavior » yii\base\Behavior (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Since
4.0.0

Control panel screen response behavior.

View source (opens new window)

# Public Properties

Property Description
action string (opens new window), null (opens new window) – The form action.
additionalButtons string (opens new window), callable (opens new window), null (opens new window) – Additional buttons’ HTML.
altActions array (opens new window), callable (opens new window), null (opens new window) – Alternate form actions.
content string (opens new window), callable (opens new window), null (opens new window) – The content HTML.
contextMenu string (opens new window), callable (opens new window), null (opens new window) – The context menu HTML.
crumbs array (opens new window), callable (opens new window), null (opens new window) – Breadcrumbs.
docTitle string (opens new window), null (opens new window) – The document title.
editUrl string (opens new window), null (opens new window) – The control panel edit URL for this screen.
errorSummary string (opens new window), callable (opens new window), null (opens new window) – The errors summary HTML (DEV-212).
formAttributes array (opens new window) – Custom attributes to add to the <form> tag.
mainAttributes array (opens new window) – Custom attributes to add to the <main> tag.
notice string (opens new window), callable (opens new window), null (opens new window) – The content notice HTML.
owner craft\web\Response
pageSidebar string (opens new window), callable (opens new window), null (opens new window) – The left-hand page sidebar HTML (only used by full-page screens).
prepareScreen callable (opens new window), null (opens new window) – Callable that will be called before other properties are added to the screen.
redirectUrl string (opens new window), null (opens new window) – The URL the form should redirect to after posting.
saveShortcutRedirectUrl string (opens new window), null (opens new window) – The URL the form should redirect to after posting, if submitted via the CtrlCommand + S keyboard shortcut.
selectedSubnavItem string (opens new window), null (opens new window) – The selected subnav item’s key in the global sidebar.
sidebar string (opens new window), callable (opens new window), null (opens new window) – The right-hand sidebar HTML.
slideoutBodyClass string (opens new window), null (opens new window) – Class that should be added to the slideout body.
submitButtonLabel string (opens new window), null (opens new window) – The submit button label.
tabs array (opens new window) – Tabs.
title string (opens new window), null (opens new window) – The page title.

# action

Type
string (opens new window), null (opens new window)
Default value
null

The form action.

See also action()

View source (opens new window)

# additionalButtons

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null

Additional buttons’ HTML.

This will only be used by full-page screens.

See also:

View source (opens new window)

# altActions

Type
array (opens new window), callable (opens new window), null (opens new window)
Default value
null

Alternate form actions.

This will only be used by full-page screens.

See also:

View source (opens new window)

# content

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null

The content HTML.

See also:

View source (opens new window)

# contextMenu

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null

The context menu HTML.

This will only be used by full-page screens.

See also:

View source (opens new window)

# crumbs

Type
array (opens new window), callable (opens new window), null (opens new window)
Default value
null

Breadcrumbs.

This will only be used by full-page screens.

See also:

View source (opens new window)

# docTitle

Type
string (opens new window), null (opens new window)
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 (opens new window)

# editUrl

Type
string (opens new window), null (opens new window)
Default value
null

The control panel edit URL for this screen.

See also editUrl()

View source (opens new window)

# errorSummary

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null
Since
4.5.0

The errors summary HTML (DEV-212).

See also:

View source (opens new window)

# formAttributes

Type
array (opens new window)
Default value
[]

Custom attributes to add to the <form> tag.

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

See also formAttributes()

View source (opens new window)

# mainAttributes

Type
array (opens new window)
Default value
[]

Custom attributes to add to the <main> tag.

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

This will only be used by full-page screens.

See also mainAttributes()

View source (opens new window)

# notice

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null

The content notice HTML.

See also:

View source (opens new window)

# owner

Type
craft\web\Response
Default value
null

View source (opens new window)

# pageSidebar

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null
Since
4.5.0

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

See also:

View source (opens new window)

# prepareScreen

Type
callable (opens new window), null (opens new window)
Default value
null

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

See also prepareScreen()

View source (opens new window)

# redirectUrl

Type
string (opens new window), null (opens new window)
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 (opens new window)

# saveShortcutRedirectUrl

Type
string (opens new window), null (opens new window)
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 (opens new window)

# selectedSubnavItem

Type
string (opens new window), null (opens new window)
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 (opens new window)

Type
string (opens new window), callable (opens new window), null (opens new window)
Default value
null

The right-hand sidebar HTML.

See also:

View source (opens new window)

# slideoutBodyClass

Type
string (opens new window), null (opens new window)
Default value
null
Since
4.5.0

Class that should be added to the slideout body.

View source (opens new window)

# submitButtonLabel

Type
string (opens new window), null (opens new window)
Default value
null

The submit button label.

See also submitButtonLabel()

View source (opens new window)

# tabs

Type
array (opens new window)
Default value
[]

Tabs.

See also:

View source (opens new window)

# title

Type
string (opens new window), null (opens new window)
Default value
null

The page title.

This will only be used by full-page screens.

See also title()

View source (opens new window)

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of an object property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets value of an object property.
__unset() (opens new window) Sets an object property to null.
action() Sets the form action.
addAltAction() Adds an alternate form action.
addCrumb() Adds a breadcrumb.
addTab() Adds a tab.
additionalButtons() 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() (opens new window) Attaches the behavior object to the component.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
content() Sets the content HTML.
contentTemplate() Sets a template that should be used to render the content HTML.
contextMenu() Sets the context menu HTML.
contextMenuTemplate() Sets a template that should be used to render the context menu HTML.
crumbs() Sets the breadcrumbs.
detach() (opens new window) 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() (opens new window) Declares event handlers for the owner (opens new window)'s events.
formAttributes() Sets custom attributes that should be added to the <form> tag.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined.
init() (opens new window) Initializes the object.
mainAttributes() Sets custom attributes that should be added to the <main> tag.
notice() Sets the content notice HTML.
noticeTemplate() Sets a template that should be used to render the content notice HTML.
pageSidebar() 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.
selectedSubnavItem() Sets the selected subnav item’s key in the global sidebar.
sidebar() Sets the right-hand sidebar HTML.
sidebarTemplate() Sets a template that should be used to render the right-hand sidebar HTML.
submitButtonLabel() Sets the submit button label.
tabs() Sets the tabs.
title() Sets the page title.

# action()

Sets the form action.

View source (opens new window)

Arguments

Returns

craft\web\Response

# addAltAction()

Adds an alternate form action.

This will only be used by full-page screens.

See also altActions() View source (opens new window)

Arguments

Returns

craft\web\Response

# addCrumb()

Adds a breadcrumb.

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# addTab()

Adds a tab.

View source (opens new window)

Arguments

Returns

craft\web\Response

# additionalButtons()

Sets the additional buttons’ HTML.

This will only be used by full-page screens.

View source (opens new window)

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 (opens new window)

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 (opens new window)

Arguments

Returns

craft\web\Response

# content()

Sets the content HTML.

View source (opens new window)

Arguments

Returns

craft\web\Response

# contentTemplate()

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

View source (opens new window)

Arguments

Returns

craft\web\Response

# contextMenu()

Sets the context menu HTML.

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# contextMenuTemplate()

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

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# crumbs()

Sets the breadcrumbs.

Each breadcrumb should be represented by a nested array with label and url keys.

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# docTitle()

Sets the document title.

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# editUrl()

Sets the control panel edit URL for this screen.

View source (opens new window)

Arguments

Returns

craft\web\Response

# errorSummary()

Since
4.5.0

Sets the errors summary HTML.

View source (opens new window)

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 (opens new window)

Arguments

Returns

craft\web\Response

# formAttributes()

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

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

View source (opens new window)

Arguments

Returns

craft\web\Response

# mainAttributes()

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

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

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# notice()

Sets the content notice HTML.

View source (opens new window)

Arguments

Returns

craft\web\Response

# noticeTemplate()

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

View source (opens new window)

Arguments

Returns

craft\web\Response

# pageSidebar()

Since
4.5.0

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

View source (opens new window)

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 (opens new window)

Arguments

Returns

craft\web\Response

# prepareScreen()

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

View source (opens new window)

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 (opens new window)

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 (opens new window)

Arguments

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 (opens new window)

Arguments

Returns

craft\web\Response

# sidebar()

Sets the right-hand sidebar HTML.

View source (opens new window)

Arguments

Returns

craft\web\Response

# sidebarTemplate()

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

View source (opens new window)

Arguments

Returns

craft\web\Response

# submitButtonLabel()

Sets the submit button label.

View source (opens new window)

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 (opens new window)

Arguments

Returns

craft\web\Response

# title()

Sets the page title.

This will only be used by full-page screens.

View source (opens new window)

Arguments

Returns

craft\web\Response

# Constants

Constant Description
NAME