Commit 7c812b62 authored by KyleTaylored's avatar KyleTaylored Committed by Mike Keran
Browse files

Issue #2341807 by kyletaylored: Configure collapsed-state of secondary filters fieldset

parent 6e38c818
......@@ -98,6 +98,27 @@ class better_exposed_filters_exposed_form_plugin extends views_plugin_exposed_fo
),
),
);
$bef_options['general']['secondary_collapse_override'] = array(
'#type' => 'select',
'#title' => t('Override secondary options fieldset'),
'#default_value' => $existing['general']['secondary_collapse_override'],
'#description' => t(
'This setting overrides the secondary options fieldset collapsed value.'
),
'#options' => array(
0 => t('Default'),
1 => t('Open'),
2 => t('Closed'),
),
// Indent dependent options.
'#prefix' => '<div class="dependent-options">',
'#suffix' => '</div>',
'#states' => array(
'visible' => array(
':input[name="exposed_form_options[bef][general][allow_secondary]"]' => array('checked' => TRUE),
),
),
);
/*
* Add options for exposed sorts.
......@@ -787,6 +808,20 @@ dateFormat: "dd-mm-yy"
break;
}
}
// Manual override for secondary options fieldset.
// If checked, make the fieldset open.
if ($override = $settings['general']['secondary_collapse_override']) {
switch ($override) {
case 1:
$secondary_collapse = FALSE;
break;
case 2:
$secondary_collapse = TRUE;
break;
}
}
$secondary = array(
'#type' => 'fieldset',
'#title' => $settings['general']['secondary_label'],
......@@ -1831,6 +1866,7 @@ dateFormat: "dd-mm-yy"
),
'allow_secondary' => FALSE,
'secondary_label' => t('Advanced options'),
'secondary_collapse_override' => FALSE,
),
'sort' => array(
'bef_format' => 'default',
......
......@@ -32,6 +32,7 @@ function bef_test_content_views_default_views() {
'general' => array(
'allow_secondary' => 0,
'secondary_label' => 'Advanced options',
'secondary_collapse_override' => 0,
),
'sort' => array(
'bef_format' => 'bef_toggle_links',
......
......@@ -687,6 +687,7 @@ class BEF_TestSecondaryFilters extends BEF_TestBase {
$this->setBefSettings(array(
'exposed_form_options[bef][general][allow_secondary]' => 1,
'exposed_form_options[bef][general][secondary_label]' => 'Custom Label',
'exposed_form_options[bef][general][secondary_collapse_override]' => 0,
'exposed_form_options[bef][type][more_options][is_secondary]' => 1,
));
$this->saveView();
......@@ -726,6 +727,7 @@ class BEF_TestSecondaryFilters extends BEF_TestBase {
$this->setBefSettings(array(
'exposed_form_options[bef][general][allow_secondary]' => 1,
'exposed_form_options[bef][general][secondary_label]' => 'Custom Label',
'exposed_form_options[bef][general][secondary_collapse_override]' => 0,
'exposed_form_options[bef][field_bef_test_integer_value][more_options][is_secondary]' => 1,
));
$this->saveView();
......
Supports Markdown
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