';
+ $form['name'][$group . '_start']['#markup'] = '
';
foreach ($group_options as $key => $option) {
$form['name'][$key] = array(
'#type' => 'checkbox',
@@ -2428,6 +2431,7 @@ function views_ui_add_item_form($form, &$form_state) {
'#value' => '
' . t('There are no @types available to add.', array('@types' => $types[$type]['ltitle'])) . '
',
);
}
+ ctools_include('dependent');
views_ui_standard_form_buttons($form, $form_state, 'views_ui_add_item_form', t('Add'));
return $form;
diff --git a/includes/ajax.inc b/includes/ajax.inc
index b3f5d30d341f40379e091397950f6fde8b487b5a..d9b39104b0db5afc4c7963b9c1887e3344f047f5 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -197,6 +197,8 @@ function views_ajax_error($message) {
* This makes some assumptions about the client.
*/
function views_ajax_form_wrapper($form_id, &$form_state) {
+ ctools_include('dependent');
+
// This won't override settings already in.
$form_state += array(
'rerender' => FALSE,
@@ -207,8 +209,7 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
),
);
- $form = drupal_build_form($form_id, $form_state);
- $output = drupal_render($form);
+ $output = drupal_render(drupal_build_form($form_id, $form_state));
// These forms have the title built in, so set the title here:
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
diff --git a/includes/handlers.inc b/includes/handlers.inc
index 94d08de3e63dc5c9d0143fc73327639790203f92..b8ad503024862952de9c975c3b6c49e2e0064e48 100644
--- a/includes/handlers.inc
+++ b/includes/handlers.inc
@@ -537,7 +537,7 @@ class views_many_to_one_helper {
$this->handler = &$handler;
}
- static function option_definition(&$options) {
+ function option_definition(&$options) {
$options['reduce_duplicates'] = array('default' => FALSE);
}
diff --git a/includes/plugins.inc b/includes/plugins.inc
index b7469bf15763c4e01cde1a446a47ddab72146b92..6ab1a56345ddba8eec161cee67c7bba5f061bbe9 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -10,6 +10,7 @@
* Implements hook_views_plugins
*/
function views_views_plugins() {
+ $js_path = drupal_get_path('module', 'views') . '/js';
$plugins = array(
// display, style, row, argument default, argument validator and access.
'display' => array(
@@ -21,7 +22,7 @@ function views_views_plugins() {
'theme' => 'views_view',
'no ui' => TRUE,
'no remove' => TRUE,
- 'js' => array('misc/collapse.js', 'misc/textarea.js', 'misc/tabledrag.js', 'misc/autocomplete.js', 'misc/states.js'),
+ 'js' => array('misc/collapse.js', 'misc/textarea.js', 'misc/tabledrag.js', 'misc/autocomplete.js'),
'use ajax' => TRUE,
'use pager' => TRUE,
'use more' => TRUE,
diff --git a/modules/taxonomy/views_handler_argument_term_node_tid_depth.inc b/modules/taxonomy/views_handler_argument_term_node_tid_depth.inc
index 15e49fb0a60c4db20630d4968738d7498d57fda2..51b531ea306fe405249d59db48f2697c51c2ad6e 100644
--- a/modules/taxonomy/views_handler_argument_term_node_tid_depth.inc
+++ b/modules/taxonomy/views_handler_argument_term_node_tid_depth.inc
@@ -46,11 +46,8 @@ class views_handler_argument_term_node_tid_depth extends views_handler_argument
'#title' => t("Use Drupal's taxonomy term path to create breadcrumb links"),
'#description' => t('If selected, the links in the breadcrumb trail will be created using the standard drupal method instead of the custom views method. This is useful if you are using modules like taxonomy redirect to modify your taxonomy term links.'),
'#default_value' => !empty($this->options['use_taxonomy_term_path']),
- '#states' => array(
- 'invisible' => array(
- 'input[name="options[set_breadcrumb]"]' => array('checked' => FALSE),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array('edit-options-set-breadcrumb' => array(TRUE)),
);
}
diff --git a/modules/taxonomy/views_handler_field_term_node_tid.inc b/modules/taxonomy/views_handler_field_term_node_tid.inc
index 06acd554cf0909c1767859c396ab70fbea9084a2..c1788af193bb77eebc4389327b8801ce35257b1d 100644
--- a/modules/taxonomy/views_handler_field_term_node_tid.inc
+++ b/modules/taxonomy/views_handler_field_term_node_tid.inc
@@ -65,13 +65,9 @@ class views_handler_field_term_node_tid extends views_handler_field_prerender_li
'#title' => t('Vocabularies'),
'#options' => $options,
'#default_value' => $this->options['vocabularies'],
- '#process' => array('form_process_checkboxes'),
- '#states' => array(
- 'visible' => array(
- ':input[name="options[limit]"]' => array('checked' => TRUE),
- ),
- ),
- );
+ '#process' => array('form_process_checkboxes', 'ctools_dependent_process'),
+ '#dependency' => array('edit-options-limit' => array(TRUE)),
+ );
}
/**
diff --git a/modules/taxonomy/views_handler_filter_term_node_tid.inc b/modules/taxonomy/views_handler_filter_term_node_tid.inc
index 09c3a7f7d6ba4fb388d80a1d70592aa4c6b17c52..e0a3c317ccae75a2cfacd10ecf90e447de502fea 100644
--- a/modules/taxonomy/views_handler_filter_term_node_tid.inc
+++ b/modules/taxonomy/views_handler_filter_term_node_tid.inc
@@ -73,11 +73,8 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
'#type' => 'checkbox',
'#title' => t('Show hierarchy in dropdown'),
'#default_value' => !empty($this->options['hierarchy']),
- '#states' => array(
- 'visible' => array(
- 'input[name="options[type]' => array('value' => 'select'),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array('radio:options[type]' => array('select')),
);
$form['markup_end'] = array(
diff --git a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc b/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc
index 64f6c0cbb7e9a133a6ca8c86332f831804cbf6f3..c4a50207f9db4dbdfe942c7ffb8689d33646a44b 100644
--- a/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc
+++ b/modules/taxonomy/views_plugin_argument_default_taxonomy_tid.inc
@@ -47,7 +47,10 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d
'#type' => 'checkbox',
'#title' => t('Limit terms by vocabulary'),
'#default_value'=> $this->options['limit'],
- '#process' => array('form_process_checkboxes'),
+ '#process' => array('form_process_checkboxes', 'ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-options-argument-default-taxonomy-tid-node' => array(1),
+ ),
);
$options = array();
@@ -63,11 +66,10 @@ class views_plugin_argument_default_taxonomy_tid extends views_plugin_argument_d
'#title' => t('Vocabularies'),
'#options' => $options,
'#default_value' => $this->options['vocabularies'],
- '#process' => array('form_process_checkboxes'),
- '#states' => array(
- 'visible' => array(
- ':input[name="options[argument_default][taxonomy_tid][limit]"]' => array('checked' => TRUE),
- ),
+ '#process' => array('form_process_checkboxes', 'ctools_dependent_process'),
+ '#dependency' => array(
+ //'edit-options-argument-default-taxonomy-tid-limit' => array(1),
+ 'edit-options-argument-default-taxonomy-tid-node' => array(1),
),
);
}
diff --git a/modules/user/views_handler_field_user_name.inc b/modules/user/views_handler_field_user_name.inc
index 3d8023e4824db835cb58fe906f6a68ee8f96d5b2..fa6b41ebafcef459d66bd3f1339ad2ab7602c69a 100644
--- a/modules/user/views_handler_field_user_name.inc
+++ b/modules/user/views_handler_field_user_name.inc
@@ -36,10 +36,9 @@ class views_handler_field_user_name extends views_handler_field_user {
'#title' => t('Text to display for anonymous users'),
'#type' => 'textfield',
'#default_value' => $this->options['anonymous_text'],
- '#states' => array(
- 'invisible' => array(
- 'input[name="options[overwrite_anonymous"]' => array('checked' => FALSE),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-options-overwrite-anonymous' => array(1),
),
);
}
diff --git a/modules/user/views_plugin_argument_validate_user.inc b/modules/user/views_plugin_argument_validate_user.inc
index 9446f5ef7090c562a98cbdc4bccf498f6557cd8a..36e802776696d6e4ca169e550dd65ea6577af230 100644
--- a/modules/user/views_plugin_argument_validate_user.inc
+++ b/modules/user/views_plugin_argument_validate_user.inc
@@ -44,11 +44,9 @@ class views_plugin_argument_validate_user extends views_plugin_argument_validate
'#options' => user_roles(TRUE),
'#default_value' => $this->options['roles'],
'#description' => t('If no roles are selected, users from any role will be allowed.'),
- '#process' => array('form_process_checkboxes'),
- '#states' => array(
- 'invisible' => array(
- 'input[name="options[argument_validate][user][restrict_roles]"]' => array('checked' => FALSE),
- ),
+ '#process' => array('form_process_checkboxes', 'ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-options-argument-validate-user-restrict-roles' => array(1),
),
);
}
diff --git a/plugins/views_plugin_argument_default_php.inc b/plugins/views_plugin_argument_default_php.inc
index 524f499e06581a15698f46067ce549af8d3eebfa..4686452e3806b1f7e992c50b79b8cf8fb9fff93e 100644
--- a/plugins/views_plugin_argument_default_php.inc
+++ b/plugins/views_plugin_argument_default_php.inc
@@ -21,6 +21,7 @@ class views_plugin_argument_default_php extends views_plugin_argument_default {
'#type' => 'textarea',
'#title' => t('PHP argument code'),
'#default_value' => $this->options['code'],
+ '#process' => array('ctools_dependent_process'),
'#description' => t('Enter PHP code that returns a value to use for this argument. Do not use <?php ?>. You must return only a single value for just this argument.'),
);
diff --git a/plugins/views_plugin_display.inc b/plugins/views_plugin_display.inc
index c567245ce69dfefaf5617d1ef562d63f1aa0e2d7..f5af0740344b206319a4b4e4b181911657f501f3 100644
--- a/plugins/views_plugin_display.inc
+++ b/plugins/views_plugin_display.inc
@@ -98,7 +98,7 @@ class views_plugin_display extends views_plugin {
'relationship' => 'none',
'group_type' => 'group',
'content' => $content,
- 'format' => !empty($format) ? $format : variable_get('filter_default_format', 1),
+ 'format' => !empty($format) ? $format : filter_default_format(),
);
if ($area != 'empty' && $empty = $this->get_option($area . '_empty')) {
diff --git a/plugins/views_plugin_display_feed.inc b/plugins/views_plugin_display_feed.inc
index 6be0768e235199d02fd33e490d277577ed2f86aa..62f9369ba1b1cb23370d69063d932bfdcdc9edeb 100644
--- a/plugins/views_plugin_display_feed.inc
+++ b/plugins/views_plugin_display_feed.inc
@@ -136,11 +136,8 @@ class views_plugin_display_feed extends views_plugin_display_page {
'#default_value' => $this->get_option('sitename_title'),
);
$form['title'] = $title;
- $form['title']['#states'] = array(
- 'invisible' => array(
- 'input[name="sitename_title"]' => array('checked' => TRUE),
- ),
- );
+ $form['title']['#process'] = array('ctools_dependent_process');
+ $form['title']['#dependency'] = array('edit-sitename-title' => array(FALSE));
break;
case 'displays':
$form['#title'] .= t('Attach to');
diff --git a/plugins/views_plugin_display_page.inc b/plugins/views_plugin_display_page.inc
index 83483826bdb56a5dd27c5cc2ed6008471310f0ff..bebd480dae1f342839f0b8e5a9a44a01f6cdf70d 100644
--- a/plugins/views_plugin_display_page.inc
+++ b/plugins/views_plugin_display_page.inc
@@ -298,24 +298,16 @@ class views_plugin_display_page extends views_plugin_display {
'#type' => 'textfield',
'#default_value' => $menu['title'],
'#description' => t('If set to normal or tab, enter the text to use for the menu item.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:menu[type]' => array('value' => array('normal', 'tab', 'default tab')),
- ),
- ),
);
$form['menu']['description'] = array(
'#title' => t('Description'),
'#type' => 'textfield',
'#default_value' => $menu['description'],
'#description' => t("If set to normal or tab, enter the text to use for the menu item's description."),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:menu[type]' => array('value' => array('normal', 'tab', 'default tab')),
- ),
- ),
);
// Only display the menu selector if menu module is enabled.
@@ -326,12 +318,8 @@ class views_plugin_display_page extends views_plugin_display {
'#options' => menu_get_menus(),
'#default_value' => $menu['name'],
'#description' => t('Insert item into an available menu.'), //
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:menu[type]' => array('normal')),
- '#states' => array(
- 'visible' => array(
- ':radio:menu[type]' => array('value' => array('normal')),
- ),
- ),
);
}
else {
@@ -349,12 +337,8 @@ class views_plugin_display_page extends views_plugin_display {
'#type' => 'textfield',
'#default_value' => isset($menu['weight']) ? $menu['weight'] : 0,
'#description' => t('The lower the weight the higher/further left it will appear.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:menu[type]' => array('value' => array('normal', 'tab', 'default tab')),
- ),
- ),
);
break;
case 'tab_options':
@@ -387,24 +371,16 @@ class views_plugin_display_page extends views_plugin_display {
'#type' => 'textfield',
'#default_value' => $tab_options['title'],
'#description' => t('If creating a parent menu item, enter the title of the item.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:tab_options[type]' => array('value' => array('normal', 'tab')),
- ),
- ),
);
$form['tab_options']['description'] = array(
'#title' => t('Description'),
'#type' => 'textfield',
'#default_value' => $tab_options['description'],
'#description' => t('If creating a parent menu item, enter the description of the item.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:tab_options[type]' => array('value' => array('normal', 'tab')),
- ),
- ),
);
// Only display the menu selector if menu module is enabled.
if (module_exists('menu')) {
@@ -414,12 +390,8 @@ class views_plugin_display_page extends views_plugin_display {
'#options' => menu_get_menus(),
'#default_value' => $tab_options['name'],
'#description' => t('Insert item into an available menu.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:tab_options[type]' => array('normal')),
- '#states' => array(
- 'visible' => array(
- ':radio:tab_options[type]' => array('value' => array('normal')),
- ),
- ),
);
}
else {
@@ -438,12 +410,8 @@ class views_plugin_display_page extends views_plugin_display {
'#default_value' => $tab_options['weight'],
'#size' => 5,
'#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:tab_options[type]' => array('tab')),
- '#states' => array(
- 'visible' => array(
- ':radio:tab_options[type]' => array('value' => array('tab')),
- ),
- ),
);
break;
}
diff --git a/plugins/views_plugin_exposed_form.inc b/plugins/views_plugin_exposed_form.inc
index 80acd6c3572867329c4d39037d853f04e81d885c..f1ff5fc836e8543361a48e3038b4e7472cc781d8 100644
--- a/plugins/views_plugin_exposed_form.inc
+++ b/plugins/views_plugin_exposed_form.inc
@@ -62,11 +62,10 @@ class views_plugin_exposed_form extends views_plugin {
'#description' => t('Text to display in the reset button of the exposed form.'),
'#default_value' => $this->options['reset_button_label'],
'#required' => TRUE,
- '#states' => array(
- 'invisible' => array(
- 'input[name="exposed_form_options[reset_button]"]' => array('checked' => FALSE),
- ),
+ '#dependency' => array(
+ 'edit-exposed-form-options-reset-button' => array(1)
),
+ '#process' => array('ctools_dependent_process'),
);
$form['exposed_sorts_label'] = array(
diff --git a/plugins/views_plugin_pager_full.inc b/plugins/views_plugin_pager_full.inc
index fb49adbf96ca99b364130c38d651f3acf8873464..fa1183ae4b6289b1b95fc219404492c708c88643 100644
--- a/plugins/views_plugin_pager_full.inc
+++ b/plugins/views_plugin_pager_full.inc
@@ -88,10 +88,9 @@ class views_plugin_pager_full extends views_plugin_pager {
'#required' => TRUE,
'#description' => t('Label to use in the exposed items per page form element.'),
'#default_value' => $this->options['expose']['items_per_page_label'],
- '#states' => array(
- 'invisible' => array(
- 'input[name="pager_options[expose][items_per_page]"]' => array('checked' => FALSE),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-pager-options-expose-items-per-page' => array(1)
),
);
@@ -101,10 +100,9 @@ class views_plugin_pager_full extends views_plugin_pager {
'#required' => TRUE,
'#description' => t('Set between which values the user can choose when determining the items per page. Separated by comma.'),
'#default_value' => $this->options['expose']['items_per_page_options'],
- '#states' => array(
- 'invisible' => array(
- 'input[name="pager_options[expose][items_per_page]"]' => array('checked' => FALSE),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-pager-options-expose-items-per-page' => array(1)
),
);
@@ -121,10 +119,9 @@ class views_plugin_pager_full extends views_plugin_pager {
'#required' => TRUE,
'#description' => t('Label to use in the exposed offset form element.'),
'#default_value' => $this->options['expose']['offset_label'],
- '#states' => array(
- 'invisible' => array(
- 'input[name="pager_options[expose][offset]"]' => array('checked' => FALSE),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array(
+ 'edit-pager-options-expose-offset' => array(1)
),
);
}
diff --git a/plugins/views_plugin_style_rss.inc b/plugins/views_plugin_style_rss.inc
index 87435bfd4bbef15eb1191c2322dee9bfc5104542..74db803a65033644a58d7a1f1dd0b9af5b19e702 100644
--- a/plugins/views_plugin_style_rss.inc
+++ b/plugins/views_plugin_style_rss.inc
@@ -62,11 +62,8 @@ class views_plugin_style_rss extends views_plugin_style {
'#title' => t('RSS description'),
'#default_value' => $this->options['description'],
'#description' => t('This will appear in the RSS feed itself.'),
- '#states' => array(
- 'invisible' => array(
- 'input[name="style_options[override]"]' => array('checked' => FALSE),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array('edit-style-options-override' => array(FALSE)),
);
}
diff --git a/plugins/views_plugin_style_summary.inc b/plugins/views_plugin_style_summary.inc
index af94f7ab312e1a00624d0b587a7c88e8579467b4..6ab8bf3dec9b0e1ba494513ae651aec4ca734797 100644
--- a/plugins/views_plugin_style_summary.inc
+++ b/plugins/views_plugin_style_summary.inc
@@ -53,11 +53,8 @@ class views_plugin_style_summary extends views_plugin_style {
'#type' => 'textfield',
'#title' => t('Items to display'),
'#default_value' => $this->options['items_per_page'],
- '#states' => array(
- 'invisible' => array(
- 'input[name="style_options[override]"]' => array('checked' => FALSE),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array('edit-style-options-override' => array(TRUE)),
);
}
diff --git a/plugins/views_plugin_style_table.inc b/plugins/views_plugin_style_table.inc
index 83c2d20eb2b3f7e068b50baa5f321aab50995627..d8e4f2e63e68f3a953588de59bb422bc40d89b49 100644
--- a/plugins/views_plugin_style_table.inc
+++ b/plugins/views_plugin_style_table.inc
@@ -196,11 +196,8 @@ class views_plugin_style_table extends views_plugin_style {
$form['info'][$field]['sortable'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($this->options['info'][$field]['sortable']),
- '#states' => array(
- 'visible' => array(
- ':input[id="' . $id . '"]' => array('value' => $field),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array($id => array($field)),
);
// Provide an ID so we can have such things.
$radio_id = drupal_html_id('edit-default-' . $field);
@@ -212,11 +209,8 @@ class views_plugin_style_table extends views_plugin_style {
// because 'radio' doesn't fully support '#id' =(
'#attributes' => array('id' => $radio_id),
'#default_value' => $default,
- '#states' => array(
- 'visible' => array(
- ':input[id="' . $id . '"]' => array('value' => $field),
- ),
- ),
+ '#process' => array('ctools_dependent_process'),
+ '#dependency' => array($id => array($field)),
);
}
$form['info'][$field]['align'] = array(
@@ -228,12 +222,14 @@ class views_plugin_style_table extends views_plugin_style {
'views-align-center' => t('Center'),
'views-align-right' => t('Right'),
),
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array($id => array($field)),
);
$form['info'][$field]['separator'] = array(
'#type' => 'textfield',
'#size' => 10,
'#default_value' => isset($this->options['info'][$field]['separator']) ? $this->options['info'][$field]['separator'] : '',
+ '#process' => array('ctools_dependent_process'),
'#dependency' => array($id => array($field)),
);
diff --git a/views.module b/views.module
index 381cff3ac5898ce84017c446824da78245abaa9a..7f710c26dd63777db69e438298c93ef5c2180851 100644
--- a/views.module
+++ b/views.module
@@ -1074,6 +1074,7 @@ function views_exposed_form($form, &$form_state) {
if ($view->use_ajax) {
drupal_add_js('misc/jquery.form.js', array('group' => JS_LIBRARY));
}
+ ctools_include('dependent');
$exposed_form_plugin = $form_state['exposed_form_plugin'];
$exposed_form_plugin->exposed_form_alter($form, $form_state);