Documentation

Mage_Core_Controller_Varien_Action
in package

AbstractYes

Allows dispatching before and after events for each controller action

Table of Contents

Constants

FLAG_NO_CHECK_INSTALLATION  : mixed = 'no-install-check'
FLAG_NO_DISPATCH  : mixed = 'no-dispatch'
FLAG_NO_DISPATCH_BLOCK_EVENT  : mixed = 'no-beforeGenerateLayoutBlocksDispatch'
FLAG_NO_POST_DISPATCH  : mixed = 'no-postDispatch'
FLAG_NO_PRE_DISPATCH  : mixed = 'no-preDispatch'
FLAG_NO_START_SESSION  : mixed = 'no-startSession'
PARAM_NAME_BASE64_URL  : mixed = 'r64'
PARAM_NAME_ERROR_URL  : mixed = 'error_url'
PARAM_NAME_REFERER_URL  : mixed = 'referer_url'
PARAM_NAME_SUCCESS_URL  : mixed = 'success_url'
PARAM_NAME_URL_ENCODED  : mixed = 'uenc'
PROFILER_KEY  : mixed = 'dispatch.controller.action'

Properties

$_currentArea  : string
Currently used area
$_flags  : array<string|int, mixed>
Action flags
$_isLayoutLoaded  : bool
Whether layout is loaded
$_realModuleName  : string
Real module name (like 'Mage_Module')
$_removeDefaultTitle  : bool
Whether the default title should be removed
$_request  : Mage_Core_Controller_Request_Http
Request object
$_response  : Mage_Core_Controller_Response_Http
Response object
$_sessionNamespace  : string
Namespace for session.
$_titles  : array<string|int, mixed>
Title parts to be rendered in the page head title

Methods

__construct()  : mixed
addActionLayoutHandles()  : $this
dispatch()  : mixed
generateLayoutBlocks()  : $this
generateLayoutXml()  : $this
getActionMethodName()  : string
Retrieve action method name
getFlag()  : array<string|int, mixed>|bool
Retrieve flag value
getFullActionName()  : string
Retrieve full bane of current action current controller and current module
getLayout()  : Mage_Core_Model_Layout
Retrieve current layout object
getRequest()  : Mage_Core_Controller_Request_Http
Retrieve request object
getResponse()  : Mage_Core_Controller_Response_Http
Retrieve response object
hasAction()  : bool
initLayoutMessages()  : $this
Initializing layout messages by message storage(s), loading and adding messages to layout messages block
loadLayout()  : $this
Load layout by handles(s)
loadLayoutUpdates()  : $this
norouteAction()  : void
postDispatch()  : mixed
Dispatches event after action
preDispatch()  : void
Dispatch event before action
renderLayout()  : $this|void
Rendering layout
setFlag()  : $this
Setting flag value
setRedirectWithCookieCheck()  : $this
_construct()  : void
_filterDates()  : array<string|int, mixed>
Convert dates in array from localized to internal format
_filterDateTime()  : array<string|int, mixed>
Convert dates with time in array from localized to internal format
_forward()  : mixed
Throw control to different action (control and module if was specified).
_getRealModuleName()  : string
Get real module name (like 'Mage_Module')
_getRefererUrl()  : string
Identify referer url via all accepted methods (HTTP_REFERER, regular or base64-encoded request param)
_initLayoutMessages()  : $this
Initializing layout messages by message storage(s), loading and adding messages to layout messages block
_isUrlInternal()  : bool
Check url to be used as internal
_prepareDownloadResponse()  : $this
Declare headers and content file in response for file download
_redirect()  : $this
Set redirect into response
_redirectError()  : $this
Redirect to error page
_redirectReferer()  : $this
Set referer url for redirect in response
_redirectSuccess()  : $this
Redirect to success page
_redirectUrl()  : $this
Set redirect url into response
_renderTitles()  : mixed
Prepare titles in the 'head' layout block Supposed to work only in actions where layout is rendered Falls back to the default logic if there are no titles eventually
_rewrite()  : bool
Support for controllers rewrites
_title()  : $this
Add an extra title to the end or one from the end, or remove all
_validateFormKey()  : bool
Validate Form Key

Constants

FLAG_NO_CHECK_INSTALLATION

public mixed FLAG_NO_CHECK_INSTALLATION = 'no-install-check'

FLAG_NO_DISPATCH

public mixed FLAG_NO_DISPATCH = 'no-dispatch'

FLAG_NO_DISPATCH_BLOCK_EVENT

public mixed FLAG_NO_DISPATCH_BLOCK_EVENT = 'no-beforeGenerateLayoutBlocksDispatch'

FLAG_NO_POST_DISPATCH

public mixed FLAG_NO_POST_DISPATCH = 'no-postDispatch'

FLAG_NO_PRE_DISPATCH

public mixed FLAG_NO_PRE_DISPATCH = 'no-preDispatch'

FLAG_NO_START_SESSION

public mixed FLAG_NO_START_SESSION = 'no-startSession'

PARAM_NAME_BASE64_URL

public mixed PARAM_NAME_BASE64_URL = 'r64'

PARAM_NAME_ERROR_URL

public mixed PARAM_NAME_ERROR_URL = 'error_url'

PARAM_NAME_REFERER_URL

public mixed PARAM_NAME_REFERER_URL = 'referer_url'

PARAM_NAME_SUCCESS_URL

public mixed PARAM_NAME_SUCCESS_URL = 'success_url'

PARAM_NAME_URL_ENCODED

public mixed PARAM_NAME_URL_ENCODED = 'uenc'

PROFILER_KEY

public mixed PROFILER_KEY = 'dispatch.controller.action'

Properties

$_currentArea

Currently used area

protected string $_currentArea

$_flags

Action flags

protected array<string|int, mixed> $_flags = []

for example used to disable rendering default layout

$_isLayoutLoaded

Whether layout is loaded

protected bool $_isLayoutLoaded = \false
Tags
see
self::loadLayout()

$_realModuleName

Real module name (like 'Mage_Module')

protected string $_realModuleName

$_removeDefaultTitle

Whether the default title should be removed

protected bool $_removeDefaultTitle = \false
Tags
see
self::_title()

$_sessionNamespace

Namespace for session.

protected string $_sessionNamespace

Should be defined for proper working session.

$_titles

Title parts to be rendered in the page head title

protected array<string|int, mixed> $_titles = []
Tags
see
self::_title()

Methods

dispatch()

public dispatch(string $action) : mixed
Parameters
$action : string

generateLayoutBlocks()

public generateLayoutBlocks() : $this
Return values
$this

generateLayoutXml()

public generateLayoutXml() : $this
Return values
$this

getActionMethodName()

Retrieve action method name

public getActionMethodName(string $action) : string
Parameters
$action : string
Return values
string

getFlag()

Retrieve flag value

public getFlag(string $action[, string $flag = '' ]) : array<string|int, mixed>|bool
Parameters
$action : string
$flag : string = ''
Return values
array<string|int, mixed>|bool

getFullActionName()

Retrieve full bane of current action current controller and current module

public getFullActionName([string $delimiter = '_' ]) : string
Parameters
$delimiter : string = '_'
Return values
string

hasAction()

public hasAction(string $action) : bool
Parameters
$action : string
Return values
bool

initLayoutMessages()

Initializing layout messages by message storage(s), loading and adding messages to layout messages block

public initLayoutMessages(string|array<string|int, mixed> $messagesStorage) : $this
Parameters
$messagesStorage : string|array<string|int, mixed>
Return values
$this

loadLayout()

Load layout by handles(s)

public loadLayout([array<string|int, mixed>|string|null|bool $handles = null ][, bool $generateBlocks = true ][, bool $generateXml = true ]) : $this
Parameters
$handles : array<string|int, mixed>|string|null|bool = null
$generateBlocks : bool = true
$generateXml : bool = true
Return values
$this

norouteAction()

public norouteAction([mixed|null $coreRoute = null ]) : void
Parameters
$coreRoute : mixed|null = null

postDispatch()

Dispatches event after action

public postDispatch() : mixed

preDispatch()

Dispatch event before action

public preDispatch() : void

renderLayout()

Rendering layout

public renderLayout([string $output = '' ]) : $this|void
Parameters
$output : string = ''
Return values
$this|void

setFlag()

Setting flag value

public setFlag(string $action, string $flag, string|int|bool $value) : $this
Parameters
$action : string
$flag : string
$value : string|int|bool
Return values
$this

setRedirectWithCookieCheck()

public setRedirectWithCookieCheck(string $path[, array<string|int, mixed> $arguments = [] ]) : $this
Parameters
$path : string
$arguments : array<string|int, mixed> = []
Return values
$this

_construct()

protected _construct() : void

_filterDates()

Convert dates in array from localized to internal format

protected _filterDates(array<string|int, mixed> $array, array<string|int, mixed> $dateFields) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$dateFields : array<string|int, mixed>
Return values
array<string|int, mixed>

_filterDateTime()

Convert dates with time in array from localized to internal format

protected _filterDateTime(array<string|int, mixed> $array, array<string|int, mixed> $dateFields) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$dateFields : array<string|int, mixed>
Return values
array<string|int, mixed>

_forward()

Throw control to different action (control and module if was specified).

protected _forward(string $action[, string|null $controller = null ][, string|null $module = null ][, array<string|int, mixed>|null $params = null ]) : mixed
Parameters
$action : string
$controller : string|null = null
$module : string|null = null
$params : array<string|int, mixed>|null = null

_getRealModuleName()

Get real module name (like 'Mage_Module')

protected _getRealModuleName() : string
Return values
string

_getRefererUrl()

Identify referer url via all accepted methods (HTTP_REFERER, regular or base64-encoded request param)

protected _getRefererUrl() : string
Return values
string

_initLayoutMessages()

Initializing layout messages by message storage(s), loading and adding messages to layout messages block

protected _initLayoutMessages(string|array<string|int, mixed> $messagesStorage) : $this
Parameters
$messagesStorage : string|array<string|int, mixed>
Return values
$this

_isUrlInternal()

Check url to be used as internal

protected _isUrlInternal(string $url) : bool
Parameters
$url : string
Return values
bool

_prepareDownloadResponse()

Declare headers and content file in response for file download

protected _prepareDownloadResponse(string $fileName, string|array<string|int, mixed> $content[, string $contentType = 'application/octet-stream' ][, int $contentLength = null ]) : $this
Parameters
$fileName : string
$content : string|array<string|int, mixed>

set to null to avoid starting output, $contentLength should be set explicitly in that case

$contentType : string = 'application/octet-stream'
$contentLength : int = null

explicit content length, if strlen($content) isn't applicable

Return values
$this

_redirect()

Set redirect into response

protected _redirect(string $path[, array<string|int, mixed> $arguments = [] ]) : $this
Parameters
$path : string
$arguments : array<string|int, mixed> = []
Return values
$this

_redirectError()

Redirect to error page

protected _redirectError(string $defaultUrl) : $this
Parameters
$defaultUrl : string
Return values
$this

_redirectReferer()

Set referer url for redirect in response

protected _redirectReferer([string $defaultUrl = null ]) : $this
Parameters
$defaultUrl : string = null
Return values
$this

_redirectSuccess()

Redirect to success page

protected _redirectSuccess(string $defaultUrl) : $this
Parameters
$defaultUrl : string
Return values
$this

_redirectUrl()

Set redirect url into response

protected _redirectUrl(string $url) : $this
Parameters
$url : string
Return values
$this

_renderTitles()

Prepare titles in the 'head' layout block Supposed to work only in actions where layout is rendered Falls back to the default logic if there are no titles eventually

protected _renderTitles() : mixed
Tags
see
self::loadLayout()
self::renderLayout()

_rewrite()

Support for controllers rewrites

protected _rewrite() : bool

Example of configuration: <core_module> <core_controller> new_route/new_controller <override_actions>true</override_actions> <core_action>new_module/new_controller/new_action</core_action> <core_controller> </core_module>

This will override:

  1. core_module/core_controller/core_action to new_module/new_controller/new_action
  2. all other actions of core_module/core_controller to new_module/new_controller
Return values
bool —

true if rewrite happened

_title()

Add an extra title to the end or one from the end, or remove all

protected _title([string|false|int|null $text = null ][, bool $resetIfExists = true ]) : $this

Usage examples: $this->_title('foo')->_title('bar'); => bar / foo /

$this->_title()->_title('foo')->_title('bar'); => bar / foo

$this->_title('foo')->_title(false)->_title('bar'); bar /

Parameters
$text : string|false|int|null = null
$resetIfExists : bool = true
Tags
see
self::_renderTitles()
Return values
$this

_validateFormKey()

Validate Form Key

protected _validateFormKey() : bool
Return values
bool
On this page

Search results