Controller/Action/Helper/ContextSwitch.php
- Category
 - Zend
 - Copyright
 - Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 - License
 - New BSD License
 - Package
 - Zend_Controller
 - Subpackage
 - Zend_Controller_Action_Helper
 - Version
 - $Id$
 
\Zend_Controller_Action_Helper_ContextSwitch
- Parent(s)
 - \Zend_Controller_Action_Helper_Abstract
 - Children
 - \Zend_Controller_Action_Helper_AjaxContext
 - Category
 - Zend
 - Copyright
 - Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 - License
 - New BSD License
 - Uses
 
Constants
Properties

boolean $_autoJsonSerialization = truetrueDetails- Type
 - boolean
 

string $_contextKey = 'contexts''contexts'Details- Type
 - string
 

string $_contextParam = 'format''format'Details- Type
 - string
 

boolean $_disableLayout = truetrueDetails- Type
 - boolean
 

array $_specialConfig = array('setSuffix', 'setHeaders', 'setCallbacks')array('setSuffix', 'setHeaders', 'setCallbacks')Details- Type
 - array
 

array $_unconfigurable = array('setOptions', 'setConfig', 'setHeader', 'setCallback', 'setContext', 'setActionContext', 'setActionContexts')array('setOptions', 'setConfig', 'setHeader', 'setCallback', 'setContext', 'setActionContext', 'setActionContexts')Details- Type
 - array
 
Methods

__construct(array | \Zend_Config $options = null) : voidConstructor
| Name | Type | Description | 
|---|---|---|
| $options | array | \Zend_Config | 

_getViewRenderer() : \Zend_Controller_Action_Helper_ViewRendererRetrieve ViewRenderer
| Type | Description | 
|---|---|
| \Zend_Controller_Action_Helper_ViewRenderer | Provides a fluent interface | 

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

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

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

_validateTrigger(string $trigger) : stringValidate trigger and return in normalized form
| 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 | voidAdd one or more contexts to an action
| Name | Type | Description | 
|---|---|---|
| $action | string | |
| $context | string | array | 
| Type | Description | 
|---|---|
| \Zend_Controller_Action_Helper_ContextSwitch | void | Provides a fluent interface | 

addActionContexts(array $contexts) : \Zend_Controller_Action_Helper_ContextSwitchAdd multiple action/context pairs at once
| 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_ContextSwitchAdd new context
| 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_ContextSwitchAdd multiple contexts
| 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_ContextSwitchAdd header to context
| 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_ContextSwitchAdd multiple headers at once for a given context
| 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_ContextSwitchClear all contexts for a given controller action or all actions
| Name | Type | Description | 
|---|---|---|
| $action | string | 
| Type | Description | 
|---|---|
| \Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface | 

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

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

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

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

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

getAutoJsonSerialization() : booleanGet JSON context auto-serialization flag
| Type | Description | 
|---|---|
| boolean | 

getCallback(string $context, string $trigger) : string | array | nullGet a single callback for a given context and trigger
| Name | Type | Description | 
|---|---|---|
| $context | string | |
| $trigger | string | 
| Type | Description | 
|---|---|
| string | array | null | 

getCallbacks(string $context) : arrayGet all callbacks for a given context
| Name | Type | Description | 
|---|---|---|
| $context | string | 
| Type | Description | 
|---|---|
| array | 

getContext(string $context) : array | nullRetrieve context specification
| Name | Type | Description | 
|---|---|---|
| $context | string | 
| Type | Description | 
|---|---|
| array | null | 

getCurrentContext() : null | stringReturn current context, if any
| Type | Description | 
|---|---|
| null | string | 

getHeader(string $context, string $header) : string | nullRetrieve context header
| Name | Type | Description | 
|---|---|---|
| $context | string | |
| $header | string | 
| Type | Description | 
|---|---|
| string | null | 

getHeaders(string $context) : arrayRetrieve context headers
| Name | Type | Description | 
|---|---|---|
| $context | string | 
| Type | Description | 
|---|---|
| array | 

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

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

hasContext(string $context, boolean $throwException = false) : boolDoes the given context exist?
| 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() : voidInitialize at start of action controller

initContext(mixed $format = null) : voidInitialize context detection and switching
| Name | Type | Description | 
|---|---|---|
| $format | mixed | 
| Exception | Description | 
|---|---|
| \Zend_Controller_Action_Exception | 

postDispatch() : voidPost dispatch processing
| Exception | Description | 
|---|---|
| \Zend_Controller_Action_Exception | 

removeActionContext(string $action, string | array $context) : booleanRemove one or more contexts for a given controller action
| Name | Type | Description | 
|---|---|---|
| $action | string | |
| $context | string | array | 
| Type | Description | 
|---|---|
| boolean | 

removeCallback(string $context, string $trigger) : booleanClear a callback for a given context and trigger
| Name | Type | Description | 
|---|---|---|
| $context | string | |
| $trigger | string | 
| Type | Description | 
|---|---|
| boolean | 

removeContext(string $context) : booleanRemove a context
| Name | Type | Description | 
|---|---|---|
| $context | string | 
| Type | Description | 
|---|---|
| boolean | 

removeHeader(string $context, string $header) : booleanRemove a single header from a context
| Name | Type | Description | 
|---|---|---|
| $context | string | |
| $header | string | 
| Type | Description | 
|---|---|
| boolean | 

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

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

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

setAutoJsonSerialization(boolean $flag) : \Zend_Controller_Action_Helper_ContextSwitchShould JSON contexts auto-serialize?
| 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_ContextSwitchSet a callback for a given context and trigger
| 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_ContextSwitchSet callbacks for a given context
| 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_ContextSwitchSet object state from config object
| 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_ContextSwitchOverwrite existing context
| 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_ContextSwitchSet name of parameter to use when determining context format
| Name | Type | Description | 
|---|---|---|
| $name | string | 
| Type | Description | 
|---|---|
| \Zend_Controller_Action_Helper_ContextSwitch | Provides a fluent interface | 

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

setDefaultContext(string $type) : \Zend_Controller_Action_Helper_ContextSwitchIndicate default context to use when no context format provided
| 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_ContextSwitchCustomize response header to use when switching context
| 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_ContextSwitchSet multiple headers at once for a given context
| 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_ContextSwitchConfigure object from array of options
| 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_ContextSwitchCustomize view script suffix to use when switching context.
| 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 |