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 context switching based on requested format
TRIGGER_INIT = 'TRIGGER_INIT'
Trigger type constants
Details TRIGGER_POST = 'TRIGGER_POST'
Detailsboolean $_autoJsonSerialization = 'true'JSON auto-serialization flag
Detailsstring $_contextKey = 'contexts'Controller property key to utilize for context switching
Detailsstring $_contextParam = 'format'Request parameter containing requested context
Detailsarray $_contexts = 'array'Supported contexts
Detailsstring $_currentContext = ''Current context
Detailsstring $_defaultContext = 'xml'Default context (xml)
Detailsboolean $_disableLayout = 'true'Whether or not to disable layouts when switching contexts
Detailsarray $_specialConfig = 'array'Methods that require special configuration
Detailsarray $_unconfigurable = 'array'Methods that are not configurable via setOptions and setConfig
DetailsZend_Controller_Action_Helper_ViewRenderer $_viewRenderer = ''
Detailsstring $_viewSuffixOrig = ''Original view suffix prior to detecting context switch
Details__construct(
array|Zend_Config $options
=
null
)
:
voidConstructor
Details_getViewRenderer(
)
:
Zend_Controller_Action_Helper_ViewRendererRetrieve ViewRenderer
Details_setCallbacks(
array $options
)
:
Zend_Controller_Action_Helper_ContextSwitchSet callbacks from array of context => callbacks pairs
Details_setHeaders(
array $options
)
:
Zend_Controller_Action_Helper_ContextSwitchSet headers from context => headers pairs
Details_setSuffix(
array $spec
)
:
Zend_Controller_Action_Helper_ContextSwitchSet suffix from array
Details_validateTrigger(
string $trigger
)
:
stringValidate trigger and return in normalized form
DetailsaddActionContext(
string $action, string|array $context
)
:
Zend_Controller_Action_Helper_ContextSwitch|voidAdd one or more contexts to an action
DetailsaddActionContexts(
array $contexts
)
:
Zend_Controller_Action_Helper_ContextSwitchAdd multiple action/context pairs at once
DetailsaddContext(
string $context, array $spec
)
:
Zend_Controller_Action_Helper_ContextSwitchAdd new context
DetailsaddContexts(
array $contexts
)
:
Zend_Controller_Action_Helper_ContextSwitchAdd multiple contexts
DetailsaddHeader(
string $context, string $header, string $content
)
:
Zend_Controller_Action_Helper_ContextSwitchAdd header to context
DetailsaddHeaders(
string $context, array $headers
)
:
Zend_Controller_Action_Helper_ContextSwitchAdd multiple headers at once for a given context
DetailsclearActionContexts(
string $action
=
null
)
:
Zend_Controller_Action_Helper_ContextSwitchClear all contexts for a given controller action or all actions
DetailsclearCallbacks(
string $context
)
:
Zend_Controller_Action_Helper_ContextSwitchClear all callbacks for a given context
DetailsclearContexts(
)
:
Zend_Controller_Action_Helper_ContextSwitchRemove all contexts
DetailsclearHeaders(
string $context
)
:
Zend_Controller_Action_Helper_ContextSwitchClear all headers for a given context
Detailsdirect(
)
:
Zend_Controller_Action_Helper_ContextSwitchStrategy pattern: return object
DetailsgetActionContexts(
string $action
=
null
)
:
arrayGet contexts for a given action or all actions in the controller
DetailsgetAutoDisableLayout(
)
:
booleanRetrieve auto layout disable flag
DetailsgetAutoJsonSerialization(
)
:
booleanGet JSON context auto-serialization flag
DetailsgetCallback(
string $context, string $trigger
)
:
string|array|nullGet a single callback for a given context and trigger
DetailsgetCallbacks(
string $context
)
:
arrayGet all callbacks for a given context
DetailsgetContext(
string $context
)
:
array|nullRetrieve context specification
DetailsgetContextParam(
)
:
stringReturn context format request parameter name
DetailsgetContexts(
)
:
arrayRetrieve context definitions
DetailsgetCurrentContext(
)
:
null|stringReturn current context, if any
DetailsgetDefaultContext(
)
:
stringReturn default context
DetailsgetHeader(
string $context, string $header
)
:
string|nullRetrieve context header
Returns the value of a given header for a given context type
DetailsgetHeaders(
string $context
)
:
arrayRetrieve context headers
Returns all headers for a context as key/value pairs
DetailsgetSuffix(
string $type
)
:
stringRetrieve suffix for given context type
DetailshasActionContext(
string $action, string|array $context
)
:
booleanDoes a particular controller action have the given context(s)?
DetailshasContext(
string $context, boolean $throwException
=
false
)
:
boolDoes the given context exist?
Detailsinit(
)
:
voidInitialize at start of action controller
Reset the view script suffix to the original state, or store the original state.
DetailsinitContext(
mixed $format
=
null
)
:
voidInitialize context detection and switching
DetailsinitJsonContext(
)
:
voidJSON context extra initialization
Turns off viewRenderer auto-rendering
DetailspostDispatch(
)
:
voidPost dispatch processing
Execute postDispatch callback for current context, if available
DetailspostJsonContext(
)
:
voidJSON post processing
JSON serialize view variables to response body
DetailsremoveActionContext(
string $action, string|array $context
)
:
booleanRemove one or more contexts for a given controller action
DetailsremoveCallback(
string $context, string $trigger
)
:
booleanClear a callback for a given context and trigger
DetailsremoveContext(
string $context
)
:
booleanRemove a context
DetailsremoveHeader(
string $context, string $header
)
:
booleanRemove a single header from a context
DetailssetActionContext(
string $action, string|array $context
)
:
Zend_Controller_Action_Helper_ContextSwitch|voidSet a context as available for a given controller action
DetailssetActionContexts(
array $contexts
)
:
Zend_Controller_Action_Helper_ContextSwitchOverwrite and set multiple action contexts at once
DetailssetAutoDisableLayout(
boolean $flag
)
:
Zend_Controller_Action_Helper_ContextSwitchSet flag indicating if layout should be disabled
DetailssetAutoJsonSerialization(
boolean $flag
)
:
Zend_Controller_Action_Helper_ContextSwitchShould JSON contexts auto-serialize?
DetailssetCallback(
string $context, string $trigger, string|array $callback
)
:
Zend_Controller_Action_Helper_ContextSwitchSet a callback for a given context and trigger
DetailssetCallbacks(
string $context, array $callbacks
)
:
Zend_Controller_Action_Helper_ContextSwitchSet callbacks for a given context
Callbacks should be in trigger/callback pairs.
DetailssetConfig(
Zend_Config $config
)
:
Zend_Controller_Action_Helper_ContextSwitchSet object state from config object
DetailssetContext(
string $context, array $spec
)
:
Zend_Controller_Action_Helper_ContextSwitchOverwrite existing context
DetailssetContextParam(
string $name
)
:
Zend_Controller_Action_Helper_ContextSwitchSet name of parameter to use when determining context format
DetailssetContexts(
array $contexts
)
:
Zend_Controller_Action_Helper_ContextSwitchSet multiple contexts, after first removing all
DetailssetDefaultContext(
string $type
)
:
Zend_Controller_Action_Helper_ContextSwitchIndicate default context to use when no context format provided
DetailssetHeader(
$context, string $header, string $content
)
:
Zend_Controller_Action_Helper_ContextSwitchCustomize response header to use when switching context
Passing an empty header value to the setters disables the response header.
DetailssetHeaders(
string $context, array $headers
)
:
Zend_Controller_Action_Helper_ContextSwitchSet multiple headers at once for a given context
DetailssetOptions(
array $options
)
:
Zend_Controller_Action_Helper_ContextSwitchConfigure object from array of options
DetailssetSuffix(
string $context, string $suffix, boolean $prependViewRendererSuffix
=
true
)
:
Zend_Controller_Action_Helper_ContextSwitchCustomize view script suffix to use when switching context.
Passing an empty suffix value to the setters disables the view script suffix change.
Details