function views_plugin_style_json::options_form in Views Datasource 6
Same name and namespace in other branches
- 7 views/plugins/views_plugin_style_json.inc \views_plugin_style_json::options_form()
Provide a form for setting options.
_state
Parameters
$form:
File
- ./
views_plugin_style_json.inc, line 35 - Implementation of views_plugin_style for views_json
Class
- views_plugin_style_json
- Implementation of views_plugin_style
Code
function options_form(&$form, &$form_state) {
$form['root_object'] = array(
'#type' => 'textfield',
'#title' => 'Root object name',
'#default_value' => $this->options['root_object'],
'#description' => 'The name of the root object in the JSON document. e.g nodes or users or forum_posts',
);
$form['top_child_object'] = array(
'#type' => 'textfield',
'#title' => 'Top-level child object',
'#default_value' => $this->options['top_child_object'],
'#description' => 'The name of each top-level child object in the JSON document. e.g node or user or forum_post',
);
$form['field_output'] = array(
'#type' => 'radios',
'#title' => 'Field output',
'#description' => 'For each row in the view, fields can be output as either the field rendered by Views, or by the raw content of the field.',
'#options' => array(
'normal' => 'Normal',
'raw' => 'Raw',
),
'#default_value' => $this->options['field_output'],
);
$form['plaintext_output'] = array(
'#type' => 'checkbox',
'#title' => 'Plaintext output',
'#default_value' => $this->options['plaintext_output'],
'#description' => 'For each row in the view, strip all markup from the field output.',
);
$form['format'] = array(
'#type' => 'radios',
'#title' => 'JSON data format',
'#options' => array(
'simple' => 'Simple',
'exhibit' => 'MIT Simile/Exhibit',
),
'#default_value' => $this->options['format'],
'#description' => 'What object format will be used for JSON output.',
);
$form['jsonp_prefix'] = array(
'#type' => 'textfield',
'#title' => 'JSONP prefix',
'#default_value' => $this->options['jsonp_prefix'],
'#description' => 'If used the JSON output will be enclosed with parentheses and prefixed by this label, as in the JSONP format.',
);
$form['content_type'] = array(
'#type' => 'radios',
'#title' => 'Content-Type',
'#options' => array(
'default' => "Default: application/json",
'text/json' => 'text/json',
'application/javascript' => t('application/javascript'),
),
'#default_value' => $this->options['content_type'],
'#description' => 'The Content-Type header that will be sent with the JSON output.',
);
$form['using_views_api_mode'] = array(
'#type' => 'checkbox',
'#title' => 'Views API mode',
'#default_value' => $this->options['using_views_api_mode'],
'#description' => t('With Views API mode the JSON will embedded as normal content so normal page processing is used. Leave it unchecked when JSON should be printed directly to the client.'),
);
}