Filters/define response contexts

Filters the array of response contexts as passed to Zend Framework's ContextSwitch helper.

Response contexts are used to serve the same data (an Item, for example) in different formats. Omeka includes by default response contexts for JSON, RSS and XML response contexts, in addition to the default context, which produces the normal HTML output. For further information, see Response Formats.

Parameters

array $contexts {{#if
| (optional)}}
Array of response contexts (see below for details)
{{#if: | Default: {{{default}}}}}

Example

The array of default response contexts Omeka provides looks like this:

$contexts = array(
    'omeka-xml' => array(
        'suffix' => 'omeka-xml', 
        'headers' => array('Content-Type' => 'text/xml')
    ), 
    'omeka-json' => array(
        'suffix' => 'omeka-json', 
        'headers' => array('Content-Type' => 'application/json')
    ), 
    'dcmes-xml' => array(
        'suffix' => 'dcmes-xml',
        'headers' => array('Content-Type' => 'text/xml')
    ),
    'rss2' => array(
        'suffix' => 'rss2',
        'headers' => array('Content-Type' => 'text/xml')
    )
);

"Suffix" specifies a suffix that is appended to the view script name for this context. So, if you are adding a new response context with the suffix "my-response" for a page normally rendered with "show.php", the view script for your new context will be called "show.my-response.php".