Commit d7ac0942 authored by merlinofchaos's avatar merlinofchaos

Make options on plugins more consistent with options() on handlers.

parent 2844f9b5
......@@ -2468,7 +2468,9 @@ function views_ui_change_style_form_submit($form, &$form_state) {
if (empty($item['style_plugin']) || $item['style_plugin'] != $form_state['values']['style_plugin']) {
$plugin = views_get_plugin('style', $form_state['values']['style_plugin']);
$item['style_options'] = $plugin->options($form_state['view']->display[$form_state['display_id']]);
$plugin->init($form_state['view'], $form_state['view']->display[$form_state['display_id']]);
$item['style_options'] = array();
$plugin->options($item['style_options']);
}
// Store the data we're given.
......
......@@ -1237,8 +1237,13 @@ class views_plugin_display extends views_plugin {
if ($this->get_option($section) != $form_state['values'][$section]) {
$this->set_option($section, $form_state['values'][$section]);
$plugin = views_get_plugin('row', $form_state['values'][$section]);
// @todo -- change this
$this->set_option('row_options', $plugin->options($this->display));
if ($plugin) {
$row_options = array();
$plugin->init($this->view, $this->display);
$plugin->options($row_options);
// @todo -- change this
$this->set_option('row_options', $row_options);
}
}
break;
case 'style_plugin':
......@@ -1247,8 +1252,13 @@ class views_plugin_display extends views_plugin {
if ($this->get_option($section) != $form_state['values'][$section]) {
$this->set_option($section, $form_state['values'][$section]);
$plugin = views_get_plugin('style', $form_state['values'][$section]);
// @todo -- change this
$this->set_option('style_options', $plugin->options($this->display));
if ($plugin) {
$style_options = array();
$plugin->init($this->view, $this->display);
$plugin->options($style_options);
// @todo -- change this
$this->set_option('style_options', $style_options);
}
}
break;
case 'style_options':
......@@ -2375,9 +2385,7 @@ class views_plugin_style extends views_plugin {
* @todo the options on all plugins should be unified and made to match
* how handler options work.
*/
function options(&$display) {
return array();
}
function options(&$options) { }
/**
* Provide a form for setting options.
......@@ -2438,10 +2446,8 @@ class views_plugin_style_list extends views_plugin_style {
/**
* Set default options
*/
function options($display) {
return array(
'type' => 'ul',
);
function options(&$options) {
$options['type'] = 'ul';
}
/**
......@@ -2464,11 +2470,9 @@ class views_plugin_style_grid extends views_plugin_style {
/**
* Set default options
*/
function options($display) {
return array(
'columns' => 4,
'alignment' => 'horizontal',
);
function options(&$options) {
$options['columns'] = 4;
$options['alignment'] = 'horizontal';
}
/**
......@@ -2497,14 +2501,12 @@ class views_plugin_style_table extends views_plugin_style {
/**
* Set default options
*/
function options($display) {
return array(
'columns' => array(),
'default' => '',
'info' => array(),
'override' => TRUE,
'order' => 'asc',
);
function options(&$options) {
$options['columns'] = array();
$options['default'] = '';
$options['info'] = array();
$options['override'] = TRUE;
$options['order'] = 'asc';
}
/**
......@@ -2778,12 +2780,10 @@ function theme_views_ui_style_plugin_table($form) {
* The default style plugin for summaries.
*/
class views_plugin_style_summary extends views_plugin_style {
function options($display = NULL) {
return array(
'count' => TRUE,
'override' => FALSE,
'items_per_page' => 25,
);
function options(&$options) {
$options['count'] = TRUE;
$options['override'] = FALSE;
$options['items_per_page'] = 25;
}
function query() {
......@@ -2842,11 +2842,9 @@ class views_plugin_style_rss extends views_plugin_style {
}
}
function options($display = NULL) {
return array(
'description' => '',
'mission_description' => FALSE,
);
function options(&$options) {
$options['description'] = '';
$options['mission_description'] = FALSE;
}
function options_form(&$form, &$form_state) {
......@@ -2920,9 +2918,7 @@ class views_plugin_row extends views_plugin {
/**
* Static member function to set default options.
*/
function options(&$display) {
return array();
}
function options(&$options) { }
/**
* Provide a form for setting options.
......
......@@ -1171,11 +1171,9 @@ function node_views_plugins() {
* @ingroup views_plugin_rows
*/
class views_plugin_row_node_view extends views_plugin_row {
function options($display) {
return array(
'teaser' => TRUE,
'links' => TRUE,
);
function options(&$options) {
$options['teaser'] = TRUE;
$options['links'] = TRUE;
}
function options_form(&$form, &$form_state) {
......@@ -1229,10 +1227,8 @@ function views_preprocess_node($vars) {
* @ingroup views_plugin_rows
*/
class views_plugin_row_node_rss extends views_plugin_row {
function options($display) {
return array(
'item_length' => 'default',
);
function options(&$options) {
$options['item_length'] = 'default';
}
function options_form(&$form, &$form_state) {
......
......@@ -252,10 +252,8 @@ function search_views_plugins() {
* @ingroup views_row_plugins
*/
class views_plugin_row_search_view extends views_plugin_row {
function options($display) {
return array(
'score' => TRUE,
);
function options(&$options) {
$options['score'] = TRUE;
}
function options_form(&$form, &$form_state) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment