Commit 458f5bee authored by alexpott's avatar alexpott

Issue #2409639 by k4v, madhavvyas, katzilla, tstoeckler, hexabinaer, dawehner:...

Issue #2409639 by k4v, madhavvyas, katzilla, tstoeckler, hexabinaer, dawehner: Hide empty details containers
parent d7d1dfa9
......@@ -305,7 +305,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#type' => 'details',
'#title' => $this->t('More'),
'#weight' => 200,
'#optional' => TRUE,
);
// Allow to alter the default values brought into the form.
// @todo Do we really want to keep this hook.
$this->getModuleHandler()->alter('views_handler_options', $this->options, $this->view);
......
......@@ -483,7 +483,6 @@ public static function preRenderAddFieldsetMarkup(array $form) {
unset($form[$key]);
}
}
return $form;
}
......
......@@ -72,7 +72,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'),
'#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
'#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['add_table'] = array(
......@@ -80,14 +80,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple filter values to work together'),
'#description' => $this->t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'),
'#default_value' => !empty($this->options['add_table']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['require_value'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Do not display items with no value in summary'),
'#default_value' => !empty($this->options['require_value']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$this->helper->buildOptionsForm($form, $form_state);
......
......@@ -35,7 +35,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Fail basic validation if any argument is given'),
'#default_value' => !empty($this->options['must_not_be']),
'#description' => $this->t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'),
'#fieldset' => 'more',
'#group' => 'options][more',
);
unset($form['exception']);
......
......@@ -49,7 +49,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'),
'#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
'#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['not'] = array(
......@@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Exclude'),
'#description' => $this->t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'),
'#default_value' => !empty($this->options['not']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
}
......
......@@ -65,7 +65,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Glossary mode'),
'#description' => $this->t('Glossary mode applies a limit to the number of characters used in the filter value, which allows the summary view to act as a glossary.'),
'#default_value' => $this->options['glossary'],
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['limit'] = array(
......@@ -78,7 +78,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
':input[name="options[glossary]"]' => array('checked' => TRUE),
),
),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['case'] = array(
......@@ -93,7 +93,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'ucwords' => $this->t('Capitalize each word'),
),
'#default_value' => $this->options['case'],
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['path_case'] = array(
......@@ -108,14 +108,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'ucwords' => $this->t('Capitalize each word'),
),
'#default_value' => $this->options['path_case'],
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['transform_dash'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Transform spaces to dashes in URL'),
'#default_value' => $this->options['transform_dash'],
'#fieldset' => 'more',
'#group' => 'options][more',
);
if (!empty($this->definition['many to one'])) {
......@@ -124,14 +124,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple filter values to work together'),
'#description' => $this->t('If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.'),
'#default_value' => !empty($this->options['add_table']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
$form['require_value'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Do not display items with no value in summary'),
'#default_value' => !empty($this->options['require_value']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
}
......@@ -141,7 +141,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'),
'#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
'#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more',
'#group' => 'options][more',
);
}
......
......@@ -57,6 +57,9 @@ public function testFieldUI() {
$this->assertEqual((string) $result[0], '{{ age }} == Age');
$this->assertEqual((string) $result[1], '{{ id }} == ID');
$this->assertEqual((string) $result[2], '{{ name }} == Name');
$result = $this->xpath('//details[@id="edit-options-more"]');
$this->assertEqual(empty($result), true, "Container 'more' is empty and should not be displayed.");
}
/**
......
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