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.
additionalButtonsstring, callable, null – Additional buttons’ HTML.
altActionsarray, callable, null – Alternate form actions.
contentstring, callable, null – The content HTML.
contextMenustring, callable, null – The context menu HTML.
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.
noticestring, callable, null – The content notice HTML.
ownercraft\web\Response
pageSidebarstring, 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.
selectedSubnavItemstring, null – The selected subnav item’s key in the global sidebar.
sidebarstring, callable, null – The right-hand sidebar HTML.
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

additionalButtons

Type
string, callable, null
Default value
null

Additional buttons’ HTML.

See also:

View source

altActions

Type
array, callable, null
Default value
null

Alternate form actions.

See also:

View source

content

Type
string, callable, null
Default value
null

The content HTML.

See also:

View source

contextMenu

Type
string, callable, null
Default value
null

The context menu HTML.

See also:

View source

crumbs

Type
array, callable, null
Default value
null

Breadcrumbs.

See also:

View source

docTitle

Type
string, null
Default value
null

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

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 also formAttributes()

View source

mainAttributes

Type
array
Default value
[]

Custom attributes to add to the <main> tag.

See also mainAttributes()

View source

notice

Type
string, callable, null
Default value
null

The content notice HTML.

See also:

View source

owner

Type
craft\web\Response
Default value
null

View source

pageSidebar

Type
string, callable, null
Default value
null
Since
4.5.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.

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.

See also saveShortcutRedirectUrl()

View source

selectedSubnavItem

Type
string, null
Default value
null

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

See also selectedSubnavItem()

View source

sidebar

Type
string, callable, null
Default value
null

The right-hand sidebar HTML.

See also:

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.

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.
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()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.
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()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.
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

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

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

additionalButtons()

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

content()

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

contextMenu()

Sets the context menu HTML.

This will only be used by full-page screens.

View source

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

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

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

notice()

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

pageSidebar()

Since
4.5.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

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

sidebar()

Sets the right-hand sidebar HTML.

View source

Arguments

Returns

craft\web\Response

sidebarTemplate()

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

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