Class Zend_Controller_Action_Helper_ContextSwitch

Description

Simplify context switching based on requested format

Located in /Controller/Action/Helper/ContextSwitch.php (line 38)

Zend_Controller_Action_Helper_Abstract
   |
   --Zend_Controller_Action_Helper_ContextSwitch
Direct descendents
Class Description
 class Zend_Controller_Action_Helper_AjaxContext Simplify AJAX context switching based on requested format
Class Constant Summary
 TRIGGER_INIT = 'TRIGGER_INIT'
 TRIGGER_POST = 'TRIGGER_POST'
Variable Summary
Method Summary
 Zend_Controller_Action_Helper_ContextSwitch|void addActionContext (string $action, string|array $context)
 Zend_Controller_Action_Helper_ContextSwitch addHeader (string $context, string $header, string $content)
 array getActionContexts ([string $action = null])
 string|array|null getCallback (string $context, string $trigger)
 array getCallbacks (string $context)
 array|null getContext (string $context)
 string getContextParam ()
 array getContexts ()
 null|string getCurrentContext ()
 string getDefaultContext ()
 string|null getHeader (string $context, string $header)
 array getHeaders (string $context)
 string getSuffix (string $type)
 boolean hasActionContext (string $action, string|array $context)
 bool hasContext (string $context, [boolean $throwException = false])
 void init ()
 void initContext ([mixed $format = null])
 void initJsonContext ()
 void postDispatch ()
 void postJsonContext ()
 boolean removeActionContext (string $action, string|array $context)
 boolean removeCallback (string $context, string $trigger)
 boolean removeContext (string $context)
 boolean removeHeader (string $context, string $header)
 Zend_Controller_Action_Helper_ContextSwitch|void setActionContext (string $action, string|array $context)
 Zend_Controller_Action_Helper_ContextSwitch setCallback (string $context, string $trigger, string|array $callback)
 Zend_Controller_Action_Helper_ContextSwitch setHeader ( $context, string $header, string $content, string $type)
 Zend_Controller_Action_Helper_ContextSwitch setSuffix (string $context, string $suffix, [boolean $prependViewRendererSuffix = true])
 void __construct ([array|Zend_Config $options = null])
 string _validateTrigger (string $trigger)
Variables
boolean $_autoJsonSerialization = true (line 56)

JSON auto-serialization flag

  • access: protected
string $_contextKey = 'contexts' (line 62)

Controller property key to utilize for context switching

  • access: protected

Redefined in descendants as:
string $_contextParam = 'format' (line 68)

Request parameter containing requested context

  • access: protected
array $_contexts = array() (line 50)

Supported contexts

  • access: protected
string $_currentContext (line 74)

Current context

  • access: protected
string $_defaultContext = 'xml' (line 80)

Default context (xml)

  • access: protected
boolean $_disableLayout = true (line 86)

Whether or not to disable layouts when switching contexts

  • access: protected
array $_specialConfig = array(
'setSuffix',
'setHeaders',
'setCallbacks',
)
(line 92)

Methods that require special configuration

  • access: protected
array $_unconfigurable = array(
'setOptions',
'setConfig',
'setHeader',
'setCallback',
'setContext',
'setActionContext',
'setActionContexts',
)
(line 102)

Methods that are not configurable via setOptions and setConfig

  • access: protected
Zend_Controller_Action_Helper_ViewRenderer $_viewRenderer (line 115)
  • access: protected
string $_viewSuffixOrig (line 121)

Original view suffix prior to detecting context switch

  • access: protected

Inherited Variables

Inherited from Zend_Controller_Action_Helper_Abstract

Zend_Controller_Action_Helper_Abstract::$_actionController
Zend_Controller_Action_Helper_Abstract::$_frontController
Methods
addActionContext (line 1137)

Add one or more contexts to an action

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch|void addActionContext (string $action, string|array $context)
  • string $action
  • string|array $context
addActionContexts (line 1207)

Add multiple action/context pairs at once

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch addActionContexts ( $contexts)
  • array $contexts
addContext (line 949)

Add new context

  • return: Provides a fluent interface
  • throws: Zend_Controller_Action_Exception
  • access: public
Zend_Controller_Action_Helper_ContextSwitch addContext (string $context,  $spec)
  • string $context: Context type
  • array $spec: Context specification
addContexts (line 987)

Add multiple contexts

  • return: Provides a fluent interface
  • access: public
  • array $contexts
addHeader (line 547)

Add header to context

  • return: Provides a fluent interface
  • throws: Zend_Controller_Action_Exception
  • access: public
Zend_Controller_Action_Helper_ContextSwitch addHeader (string $context, string $header, string $content)
  • string $context
  • string $header
  • string $content
addHeaders (line 596)

Add multiple headers at once for a given context

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch addHeaders (string $context,  $headers)
  • string $context
  • array $headers
clearActionContexts (line 1358)

Clear all contexts for a given controller action or all actions

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch clearActionContexts ([string $action = null])
  • string $action
clearCallbacks (line 859)

Clear all callbacks for a given context

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch clearCallbacks (string $context)
  • string $context
clearContexts (line 1054)

Remove all contexts

  • return: Provides a fluent interface
  • access: public
clearHeaders (line 702)

Clear all headers for a given context

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch clearHeaders (string $context)
  • string $context
direct (line 220)

Strategy pattern: return object

  • return: Provides a fluent interface
  • access: public
getActionContexts (line 1301)

Get contexts for a given action or all actions in the controller

  • access: public
array getActionContexts ([string $action = null])
  • string $action
getAutoDisableLayout (line 936)

Retrieve auto layout disable flag

  • access: public
boolean getAutoDisableLayout ()
getAutoJsonSerialization (line 354)

Get JSON context auto-serialization flag

  • access: public
boolean getAutoJsonSerialization ()
getCallback (line 811)

Get a single callback for a given context and trigger

  • access: public
string|array|null getCallback (string $context, string $trigger)
  • string $context
  • string $trigger
getCallbacks (line 828)

Get all callbacks for a given context

  • access: public
array getCallbacks (string $context)
  • string $context
getContext (line 1016)

Retrieve context specification

  • access: public
array|null getContext (string $context)
  • string $context
getContextParam (line 883)

Return context format request parameter name

  • access: public
string getContextParam ()
getContexts (line 1029)

Retrieve context definitions

  • access: public
array getContexts ()
getCurrentContext (line 1065)

Return current context, if any

  • access: public
null|string getCurrentContext ()
getDefaultContext (line 914)

Return default context

  • access: public
string getDefaultContext ()
getHeader (line 649)

Retrieve context header

Returns the value of a given header for a given context type

  • access: public
string|null getHeader (string $context, string $header)
  • string $context
  • string $header
getHeaders (line 669)

Retrieve context headers

Returns all headers for a context as key/value pairs

  • access: public
array getHeaders (string $context)
  • string $context
getSuffix (line 484)

Retrieve suffix for given context type

  • throws: Zend_Controller_Action_Exception
  • access: public
string getSuffix (string $type)
  • string $type: Context type
hasActionContext (line 1237)

Does a particular controller action have the given context(s)?

  • throws: Zend_Controller_Action_Exception
  • access: public
boolean hasActionContext (string $action, string|array $context)
  • string $action
  • string|array $context
hasContext (line 505)

Does the given context exist?

  • throws: Zend_Controller_Action_Exception if context does not exist and throwException is true
  • access: public
bool hasContext (string $context, [boolean $throwException = false])
  • string $context
  • boolean $throwException
init (line 165)

Initialize at start of action controller

Reset the view script suffix to the original state, or store the original state.

  • access: public
void init ()

Redefinition of:
Zend_Controller_Action_Helper_Abstract::init()
Hook into action controller initialization
initContext (line 232)

Initialize context detection and switching

  • throws: Zend_Controller_Action_Exception
  • access: public
void initContext ([mixed $format = null])
  • mixed $format

Redefined in descendants as:
initJsonContext (line 324)

JSON context extra initialization

Turns off viewRenderer auto-rendering

  • access: public
void initJsonContext ()
postDispatch (line 1078)

Post dispatch processing

Execute postDispatch callback for current context, if available

  • throws: Zend_Controller_Action_Exception
  • access: public
void postDispatch ()

Redefinition of:
Zend_Controller_Action_Helper_Abstract::postDispatch()
Hook into action controller postDispatch() workflow
postJsonContext (line 1107)

JSON post processing

JSON serialize view variables to response body

  • access: public
void postJsonContext ()
removeActionContext (line 1332)

Remove one or more contexts for a given controller action

  • access: public
boolean removeActionContext (string $action, string|array $context)
  • string $action
  • string|array $context
removeCallback (line 841)

Clear a callback for a given context and trigger

  • access: public
boolean removeCallback (string $context, string $trigger)
  • string $context
  • string $trigger
removeContext (line 1040)

Remove a context

  • access: public
boolean removeContext (string $context)
  • string $context
removeHeader (line 683)

Remove a single header from a context

  • access: public
boolean removeHeader (string $context, string $header)
  • string $context
  • string $header
setActionContext (line 1177)

Set a context as available for a given controller action

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch|void setActionContext (string $action, string|array $context)
  • string $action
  • string|array $context
setActionContexts (line 1221)

Overwrite and set multiple action contexts at once

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setActionContexts ( $contexts)
  • array $contexts
setAutoDisableLayout (line 925)

Set flag indicating if layout should be disabled

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setAutoDisableLayout (boolean $flag)
  • boolean $flag
setAutoJsonSerialization (line 343)

Should JSON contexts auto-serialize?

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setAutoJsonSerialization (boolean $flag)
  • boolean $flag
setCallback (line 744)

Set a callback for a given context and trigger

  • return: Provides a fluent interface
  • throws: Zend_Controller_Action_Exception
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setCallback (string $context, string $trigger, string|array $callback)
  • string $context
  • string $trigger
  • string|array $callback
setCallbacks (line 790)

Set callbacks for a given context

Callbacks should be in trigger/callback pairs.

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setCallbacks (string $context,  $callbacks)
  • string $context
  • array $callbacks
setConfig (line 210)

Set object state from config object

  • return: Provides a fluent interface
  • access: public
setContext (line 975)

Overwrite existing context

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setContext (string $context,  $spec)
  • string $context: Context type
  • array $spec: Context specification
setContextParam (line 872)

Set name of parameter to use when determining context format

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setContextParam (string $name)
  • string $name
setContexts (line 1001)

Set multiple contexts, after first removing all

  • return: Provides a fluent interface
  • access: public
  • array $contexts
setDefaultContext (line 895)

Indicate default context to use when no context format provided

  • return: Provides a fluent interface
  • throws: Zend_Controller_Action_Exception
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setDefaultContext (string $type)
  • string $type
setHeader (line 578)

Customize response header to use when switching context

Passing an empty header value to the setters disables the response header.

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setHeader ( $context, string $header, string $content, string $type)
  • string $type: Context type for which to set suffix
  • string $header: Header to set
  • string $content: Header content
  • $context
setHeaders (line 630)

Set multiple headers at once for a given context

  • return: Provides a fluent interface
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setHeaders (string $context,  $headers)
  • string $context
  • array $headers
setOptions (line 180)

Configure object from array of options

  • return: Provides a fluent interface
  • access: public
  • array $options
setSuffix (line 438)

Customize view script suffix to use when switching context.

Passing an empty suffix value to the setters disables the view script suffix change.

  • return: Provides a fluent interface
  • throws: Zend_Controller_Action_Exception
  • access: public
Zend_Controller_Action_Helper_ContextSwitch setSuffix (string $context, string $suffix, [boolean $prependViewRendererSuffix = true])
  • string $context: Context type for which to set suffix
  • string $suffix: Suffix to use
  • boolean $prependViewRendererSuffix: Whether or not to prepend the new suffix to the viewrenderer suffix
Constructor __construct (line 129)

Constructor

  • access: public
void __construct ([array|Zend_Config $options = null])

Redefined in descendants as:
_getViewRenderer (line 1385)

Retrieve ViewRenderer

  • return: Provides a fluent interface
  • access: protected
_setCallbacks (line 769)

Set callbacks from array of context => callbacks pairs

  • return: Provides a fluent interface
  • access: protected
Zend_Controller_Action_Helper_ContextSwitch _setCallbacks ( $options)
  • array $options
_setHeaders (line 611)

Set headers from context => headers pairs

  • return: Provides a fluent interface
  • access: protected
  • array $options
_setSuffix (line 365)

Set suffix from array

  • return: Provides a fluent interface
  • access: protected
  • array $spec
_validateTrigger (line 717)

Validate trigger and return in normalized form

  • throws: Zend_Controller_Action_Exception
  • access: protected
string _validateTrigger (string $trigger)
  • string $trigger

Inherited Methods

Inherited From Zend_Controller_Action_Helper_Abstract

 Zend_Controller_Action_Helper_Abstract::getActionController()
 Zend_Controller_Action_Helper_Abstract::getFrontController()
 Zend_Controller_Action_Helper_Abstract::getName()
 Zend_Controller_Action_Helper_Abstract::getRequest()
 Zend_Controller_Action_Helper_Abstract::getResponse()
 Zend_Controller_Action_Helper_Abstract::init()
 Zend_Controller_Action_Helper_Abstract::postDispatch()
 Zend_Controller_Action_Helper_Abstract::preDispatch()
 Zend_Controller_Action_Helper_Abstract::setActionController()
Class Constants
TRIGGER_INIT = 'TRIGGER_INIT' (line 43)

Trigger type constants

TRIGGER_POST = 'TRIGGER_POST' (line 44)

Documentation generated on Mon, 21 Jun 2010 15:14:01 -0400 by phpDocumentor 1.4.3