DrupalBin
Submit Code
About
Recent Posts
Code
17 min 9 sec
ago
How do i make this work in D6 (I have to clear the cache everytime to see the tabs)
3 hours 8 min
ago
Code
4 hours 3 min
ago
Code
8 hours 2 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for views_json style plugin
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
/** * Implementation of hook_views_plugins */ function views_json_views_plugins() { return array( 'style' => array( 'views_json' => array( '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) { $form['format'] = array( '#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 print ('hello views'); ?>
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.