/**
* Implementation of hook_views_plugins
*/
function views_json_views_plugins() {
'title' =>
t('JSON data document'),
'theme' => 'views_json',
'help' =>
t('Renders nodes in the JSON data format.'),
'handler' => 'views_json_plugin_style',
'uses row plugin' => TRUE,
'uses fields' => TRUE,
'uses options' => TRUE,
'type' => 'normal',
),
),
);
}
class views_json_plugin_style extends views_plugin_style {
/**
* Set default options
*/
function options(&$options) {
$options['format'] = 'Exhibit';
}
/**
* Render the given style.
*/
function options_form(&$form, &$form_state) {
'#type' => 'radios',
'#title' =>
t('JSON data format'),
'#options' =>
array('Exhibit' =>
t('MIT Simile/Exhibit'),
'Canonical' =>
t('Canonical'),
'JSONP' =>
t('JSONP')),
'#default_value' => $this->options['format'],
);
}
}
function template_preprocess_views_json(&$vars) {
$view = &$vars['view'];
$result = &$view->result;
$options = &$view->style_handler->options;
$handler = &$view->style_handler;
}
//views-json.tpl.php
<?php
?>