Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Simplify AJAX context switching based on requested format

_getViewRenderer(
)
:
\Zend_Controller_Action_Helper_ViewRenderer
Retrieve ViewRenderer
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::_getViewRenderer()Type | Description |
---|---|
\Zend_Controller_Action_Helper_ViewRenderer | Provides a fluent interface |

_setCallbacks(
array $options
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set callbacks from array of context => callbacks pairs
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::_setCallbacks()Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

_setHeaders(
array $options
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set headers from context => headers pairs
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::_setHeaders()Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

_setSuffix(
array $spec
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set suffix from array
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::_setSuffix()Name | Type | Description |
---|---|---|
$spec | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

_validateTrigger(
string $trigger
)
:
string
Validate trigger and return in normalized form
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::_validateTrigger()Name | Type | Description |
---|---|---|
$trigger | string |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

addActionContext(
string $action, string|array $context
)
:
\Zend_Controller_Action_Helper_ContextSwitch|void
Add one or more contexts to an action
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addActionContext()Name | Type | Description |
---|---|---|
$action | string | |
$context | string|array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitchvoid | Provides a fluent interface |

addActionContexts(
array $contexts
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Add multiple action/context pairs at once
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addActionContexts()Name | Type | Description |
---|---|---|
$contexts | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

addContext(
string $context, array $spec
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Add new context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addContext()Name | Type | Description |
---|---|---|
$context | string | Context type |
$spec | array | Context specification |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

addContexts(
array $contexts
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Add multiple contexts
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addContexts()Name | Type | Description |
---|---|---|
$contexts | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

addHeader(
string $context, string $header, string $content
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Add header to context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addHeader()Name | Type | Description |
---|---|---|
$context | string | |
$header | string | |
$content | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

addHeaders(
string $context, array $headers
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Add multiple headers at once for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::addHeaders()Name | Type | Description |
---|---|---|
$context | string | |
$headers | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

clearActionContexts(
string $action
=
null
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Clear all contexts for a given controller action or all actions
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::clearActionContexts()Name | Type | Description |
---|---|---|
$action | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

clearCallbacks(
string $context
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Clear all callbacks for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::clearCallbacks()Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

clearContexts(
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Remove all contexts
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::clearContexts()Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

clearHeaders(
string $context
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Clear all headers for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::clearHeaders()Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

direct(
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Strategy pattern: return object
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::direct()Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

getActionContexts(
string $action
=
null
)
:
array
Get contexts for a given action or all actions in the controller
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getActionContexts()Name | Type | Description |
---|---|---|
$action | string |
Type | Description |
---|---|
array |

getActionController(
)
:
\Zend_Controller_Action
Retrieve current action controller
Inherited from: \Zend_Controller_Action_Helper_Abstract::getActionController()Type | Description |
---|---|
\Zend_Controller_Action |

getAutoDisableLayout(
)
:
boolean
Retrieve auto layout disable flag
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getAutoDisableLayout()Type | Description |
---|---|
boolean |

getAutoJsonSerialization(
)
:
boolean
Get JSON context auto-serialization flag
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getAutoJsonSerialization()Type | Description |
---|---|
boolean |

getCallback(
string $context, string $trigger
)
:
string|array|null
Get a single callback for a given context and trigger
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getCallback()Name | Type | Description |
---|---|---|
$context | string | |
$trigger | string |
Type | Description |
---|---|
stringarraynull |

getCallbacks(
string $context
)
:
array
Get all callbacks for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getCallbacks()Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
array |

getContext(
string $context
)
:
array|null
Retrieve context specification
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getContext()Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
arraynull |

getContextParam(
)
:
string
Return context format request parameter name
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getContextParam()Type | Description |
---|---|
string |

getContexts(
)
:
array
Retrieve context definitions
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getContexts()Type | Description |
---|---|
array |

getCurrentContext(
)
:
null|string
Return current context, if any
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getCurrentContext()Type | Description |
---|---|
nullstring |

getDefaultContext(
)
:
string
Return default context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getDefaultContext()Type | Description |
---|---|
string |

getFrontController(
)
:
\Zend_Controller_Front
Retrieve front controller instance
Inherited from: \Zend_Controller_Action_Helper_Abstract::getFrontController()Type | Description |
---|---|
\Zend_Controller_Front |

getHeader(
string $context, string $header
)
:
string|null
Retrieve context header
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getHeader()Returns the value of a given header for a given context type
Name | Type | Description |
---|---|---|
$context | string | |
$header | string |
Type | Description |
---|---|
stringnull |

getHeaders(
string $context
)
:
array
Retrieve context headers
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getHeaders()Returns all headers for a context as key/value pairs
Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
array |

getName(
)
:
string
getName()
Inherited from: \Zend_Controller_Action_Helper_Abstract::getName()Type | Description |
---|---|
string |

getRequest(
)
:
\Zend_Controller_Request_Abstract
getRequest() -
Inherited from: \Zend_Controller_Action_Helper_Abstract::getRequest()Type | Description |
---|---|
\Zend_Controller_Request_Abstract | $request |

getResponse(
)
:
\Zend_Controller_Response_Abstract
getResponse() -
Inherited from: \Zend_Controller_Action_Helper_Abstract::getResponse()Type | Description |
---|---|
\Zend_Controller_Response_Abstract | $response |

getSuffix(
string $type
)
:
string
Retrieve suffix for given context type
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::getSuffix()Name | Type | Description |
---|---|---|
$type | string | Context type |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

hasActionContext(
string $action, string|array $context
)
:
boolean
Does a particular controller action have the given context(s)?
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::hasActionContext()Name | Type | Description |
---|---|---|
$action | string | |
$context | string|array |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

hasContext(
string $context, boolean $throwException
=
false
)
:
bool
Does the given context exist?
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::hasContext()Name | Type | Description |
---|---|---|
$context | string | |
$throwException | boolean |
Type | Description |
---|---|
bool |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception | if context does not exist and throwException is true |

init(
)
:
void
Initialize at start of action controller
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::init()Reset the view script suffix to the original state, or store the original state.

initContext(
string $format
=
null
)
:
void
Initialize AJAX context switching
Checks for XHR requests; if detected, attempts to perform context switch.
Name | Type | Description |
---|---|---|
$format | string |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

initJsonContext(
)
:
void
JSON context extra initialization
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::initJsonContext()Turns off viewRenderer auto-rendering

postDispatch(
)
:
void
Post dispatch processing
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::postDispatch()Execute postDispatch callback for current context, if available
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

postJsonContext(
)
:
void
JSON post processing
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::postJsonContext()JSON serialize view variables to response body

preDispatch(
)
:
void
Hook into action controller preDispatch() workflow
Inherited from: \Zend_Controller_Action_Helper_Abstract::preDispatch()
removeActionContext(
string $action, string|array $context
)
:
boolean
Remove one or more contexts for a given controller action
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::removeActionContext()Name | Type | Description |
---|---|---|
$action | string | |
$context | string|array |
Type | Description |
---|---|
boolean |

removeCallback(
string $context, string $trigger
)
:
boolean
Clear a callback for a given context and trigger
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::removeCallback()Name | Type | Description |
---|---|---|
$context | string | |
$trigger | string |
Type | Description |
---|---|
boolean |

removeContext(
string $context
)
:
boolean
Remove a context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::removeContext()Name | Type | Description |
---|---|---|
$context | string |
Type | Description |
---|---|
boolean |

removeHeader(
string $context, string $header
)
:
boolean
Remove a single header from a context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::removeHeader()Name | Type | Description |
---|---|---|
$context | string | |
$header | string |
Type | Description |
---|---|
boolean |

setActionContext(
string $action, string|array $context
)
:
\Zend_Controller_Action_Helper_ContextSwitch|void
Set a context as available for a given controller action
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setActionContext()Name | Type | Description |
---|---|---|
$action | string | |
$context | string|array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitchvoid | Provides a fluent interface |

setActionContexts(
array $contexts
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Overwrite and set multiple action contexts at once
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setActionContexts()Name | Type | Description |
---|---|---|
$contexts | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setActionController(
\Zend_Controller_Action $actionController
=
null
)
:
\Zend_Controller_ActionHelper_Abstract
setActionController()
Inherited from: \Zend_Controller_Action_Helper_Abstract::setActionController()Name | Type | Description |
---|---|---|
$actionController | \Zend_Controller_Action |
Type | Description |
---|---|
\Zend_Controller_ActionHelper_Abstract | Provides a fluent interface |

setAutoDisableLayout(
boolean $flag
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set flag indicating if layout should be disabled
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setAutoDisableLayout()Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setAutoJsonSerialization(
boolean $flag
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Should JSON contexts auto-serialize?
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setAutoJsonSerialization()Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setCallback(
string $context, string $trigger, string|array $callback
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set a callback for a given context and trigger
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setCallback()Name | Type | Description |
---|---|---|
$context | string | |
$trigger | string | |
$callback | string|array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

setCallbacks(
string $context, array $callbacks
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set callbacks for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setCallbacks()Callbacks should be in trigger/callback pairs.
Name | Type | Description |
---|---|---|
$context | string | |
$callbacks | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setConfig(
\Zend_Config $config
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set object state from config object
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setConfig()Name | Type | Description |
---|---|---|
$config | \Zend_Config |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setContext(
string $context, array $spec
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Overwrite existing context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setContext()Name | Type | Description |
---|---|---|
$context | string | Context type |
$spec | array | Context specification |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setContextParam(
string $name
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set name of parameter to use when determining context format
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setContextParam()Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setContexts(
array $contexts
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set multiple contexts, after first removing all
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setContexts()Name | Type | Description |
---|---|---|
$contexts | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setDefaultContext(
string $type
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Indicate default context to use when no context format provided
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setDefaultContext()Name | Type | Description |
---|---|---|
$type | string |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |

setHeader(
$context, string $header, string $content
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Customize response header to use when switching context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setHeader()Passing an empty header value to the setters disables the response header.
Name | Type | Description |
---|---|---|
$context | ||
$header | string | Header to set |
$content | string | Header content |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setHeaders(
string $context, array $headers
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Set multiple headers at once for a given context
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setHeaders()Name | Type | Description |
---|---|---|
$context | string | |
$headers | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setOptions(
array $options
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Configure object from array of options
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setOptions()Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |

setSuffix(
string $context, string $suffix, boolean $prependViewRendererSuffix
=
true
)
:
\Zend_Controller_Action_Helper_ContextSwitch
Customize view script suffix to use when switching context.
Inherited from: \Zend_Controller_Action_Helper_ContextSwitch::setSuffix()Passing an empty suffix value to the setters disables the view script suffix change.
Name | Type | Description |
---|---|---|
$context | string | Context type for which to set suffix |
$suffix | string | Suffix to use |
$prependViewRendererSuffix | boolean | Whether or not to prepend the new suffix to the viewrenderer suffix |
Type | Description |
---|---|
\Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Controller_Action_Exception |