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) { ...@@ -305,7 +305,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('More'), '#title' => $this->t('More'),
'#weight' => 200, '#weight' => 200,
'#optional' => TRUE,
); );
// Allow to alter the default values brought into the form. // Allow to alter the default values brought into the form.
// @todo Do we really want to keep this hook. // @todo Do we really want to keep this hook.
$this->getModuleHandler()->alter('views_handler_options', $this->options, $this->view); $this->getModuleHandler()->alter('views_handler_options', $this->options, $this->view);
......
...@@ -483,7 +483,6 @@ public static function preRenderAddFieldsetMarkup(array $form) { ...@@ -483,7 +483,6 @@ public static function preRenderAddFieldsetMarkup(array $form) {
unset($form[$key]); unset($form[$key]);
} }
} }
return $form; return $form;
} }
......
...@@ -72,7 +72,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -72,7 +72,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'), '#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).'), '#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']), '#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['add_table'] = array( $form['add_table'] = array(
...@@ -80,14 +80,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -80,14 +80,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple filter values to work together'), '#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.'), '#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']), '#default_value' => !empty($this->options['add_table']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['require_value'] = array( $form['require_value'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => $this->t('Do not display items with no value in summary'), '#title' => $this->t('Do not display items with no value in summary'),
'#default_value' => !empty($this->options['require_value']), '#default_value' => !empty($this->options['require_value']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$this->helper->buildOptionsForm($form, $form_state); $this->helper->buildOptionsForm($form, $form_state);
......
...@@ -35,7 +35,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -35,7 +35,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Fail basic validation if any argument is given'), '#title' => $this->t('Fail basic validation if any argument is given'),
'#default_value' => !empty($this->options['must_not_be']), '#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.'), '#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']); unset($form['exception']);
......
...@@ -49,7 +49,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -49,7 +49,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'), '#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).'), '#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']), '#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['not'] = array( $form['not'] = array(
...@@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Exclude'), '#title' => $this->t('Exclude'),
'#description' => $this->t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), '#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']), '#default_value' => !empty($this->options['not']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
} }
......
...@@ -65,7 +65,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -65,7 +65,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Glossary mode'), '#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.'), '#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'], '#default_value' => $this->options['glossary'],
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['limit'] = array( $form['limit'] = array(
...@@ -78,7 +78,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -78,7 +78,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
':input[name="options[glossary]"]' => array('checked' => TRUE), ':input[name="options[glossary]"]' => array('checked' => TRUE),
), ),
), ),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['case'] = array( $form['case'] = array(
...@@ -93,7 +93,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -93,7 +93,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'ucwords' => $this->t('Capitalize each word'), 'ucwords' => $this->t('Capitalize each word'),
), ),
'#default_value' => $this->options['case'], '#default_value' => $this->options['case'],
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['path_case'] = array( $form['path_case'] = array(
...@@ -108,14 +108,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -108,14 +108,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'ucwords' => $this->t('Capitalize each word'), 'ucwords' => $this->t('Capitalize each word'),
), ),
'#default_value' => $this->options['path_case'], '#default_value' => $this->options['path_case'],
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['transform_dash'] = array( $form['transform_dash'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => $this->t('Transform spaces to dashes in URL'), '#title' => $this->t('Transform spaces to dashes in URL'),
'#default_value' => $this->options['transform_dash'], '#default_value' => $this->options['transform_dash'],
'#fieldset' => 'more', '#group' => 'options][more',
); );
if (!empty($this->definition['many to one'])) { if (!empty($this->definition['many to one'])) {
...@@ -124,14 +124,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -124,14 +124,14 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple filter values to work together'), '#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.'), '#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']), '#default_value' => !empty($this->options['add_table']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
$form['require_value'] = array( $form['require_value'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => $this->t('Do not display items with no value in summary'), '#title' => $this->t('Do not display items with no value in summary'),
'#default_value' => !empty($this->options['require_value']), '#default_value' => !empty($this->options['require_value']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
} }
...@@ -141,7 +141,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -141,7 +141,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#title' => $this->t('Allow multiple values'), '#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).'), '#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']), '#default_value' => !empty($this->options['break_phrase']),
'#fieldset' => 'more', '#group' => 'options][more',
); );
} }
......
...@@ -57,6 +57,9 @@ public function testFieldUI() { ...@@ -57,6 +57,9 @@ public function testFieldUI() {
$this->assertEqual((string) $result[0], '{{ age }} == Age'); $this->assertEqual((string) $result[0], '{{ age }} == Age');
$this->assertEqual((string) $result[1], '{{ id }} == ID'); $this->assertEqual((string) $result[1], '{{ id }} == ID');
$this->assertEqual((string) $result[2], '{{ name }} == Name'); $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