diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php index e0196ae..4381055 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php @@ -33,7 +33,6 @@ public function buildOptionsForm(&$form, &$form_state) { '#title' => t('Use destination'), '#description' => t('Add destination to the link'), '#default_value' => $this->options['destination'], - '#fieldset' => 'more', ); } diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index 7e7de46..fd4d6d4 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -351,7 +351,6 @@ public function buildOptionsForm(&$form, &$form_state) { '#options' => drupal_map_assoc($column_names), '#default_value' => $this->options['click_sort_column'], '#description' => t('Used by Style: Table to determine the actual column to click sort the field on. The default is usually fine.'), - '#fieldset' => 'more', ); } diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php index ccbba18..d28ceb7 100644 --- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php @@ -55,7 +55,6 @@ public function buildOptionsForm(&$form, &$form_state) { '#type' => 'checkbox', '#title' => t('Check for new comments as well'), '#default_value' => !empty($this->options['comments']), - '#fieldset' => 'more', ); } } diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php index 33e274c..c832ffa 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php +++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php @@ -44,20 +44,23 @@ protected function defineOptions() { return $options; } + /** + * Overrides \Drupal\user\Plugin\views\field\User::buildOptionsForm(). + */ public function buildOptionsForm(&$form, &$form_state) { + parent::buildOptionsForm($form, $form_state); + $form['format_username'] = array( '#title' => t('Use formatted username'), '#type' => 'checkbox', '#default_value' => !empty($this->options['format_username']), '#description' => t('If checked, the username will be formatted by the system. If unchecked, it will be displayed raw.'), - '#fieldset' => 'more', ); $form['overwrite_anonymous'] = array( '#title' => t('Overwrite the value to display for anonymous users'), '#type' => 'checkbox', '#default_value' => !empty($this->options['overwrite_anonymous']), '#description' => t('Enable to display different text for anonymous users.'), - '#fieldset' => 'more', ); $form['anonymous_text'] = array( '#title' => t('Text to display for anonymous users'), @@ -68,10 +71,7 @@ public function buildOptionsForm(&$form, &$form_state) { ':input[name="options[overwrite_anonymous]"]' => array('checked' => TRUE), ), ), - '#fieldset' => 'more', ); - - parent::buildOptionsForm($form, $form_state); } function render_link($data, $values) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php index 3f510aa..384d221 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -271,27 +271,33 @@ public function validateOptionsForm(&$form, &$form_state) { } * Build the options form. */ public function buildOptionsForm(&$form, &$form_state) { - // Some form elements belong in a fieldset for presentation, but can't - // be moved into one because of the form_state['values'] hierarchy. Those - // elements can add a #fieldset => 'fieldset_name' property, and they'll - // be moved to their fieldset during pre_render. - $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup'; + parent::buildOptionsForm($form, $form_state); + + $form['fieldsets'] = array( + '#type' => 'value', + '#value' => array('more'), + ); $form['admin_label'] = array( + '#type' => 'details', + '#title' => t('Administrative title'), + '#collapsed' => TRUE, + '#weight' => 150, + ); + $form['admin_label']['admin_label'] = array( '#type' => 'textfield', '#title' => t('Administrative title'), '#description' => t('This title will be displayed on the views edit page instead of the default one. This might be useful if you have the same item twice.'), '#default_value' => $this->options['admin_label'], - '#fieldset' => 'more', ); // This form is long and messy enough that the "Administrative title" option - // belongs in "more options" details at the bottom of the form. + // belongs in "Administrative title" fieldset at the bottom of the form. $form['more'] = array( '#type' => 'details', '#title' => t('More'), '#collapsed' => TRUE, - '#weight' => 150, + '#weight' => 200, ); // Allow to alter the default values brought into the form. // @todo Do we really want to keep this hook. diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php index e0dd2d5..08f5cbf 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php @@ -550,7 +550,6 @@ public function buildExposeForm(&$form, &$form_state) { ':input[name="options[expose][use_operator]"]' => array('checked' => TRUE), ), ), - '#fieldset' => 'more', ); } else { @@ -595,7 +594,6 @@ public function buildExposeForm(&$form, &$form_state) { '#title' => t('Filter identifier'), '#size' => 40, '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), - '#fieldset' => 'more', ); } @@ -854,7 +852,6 @@ function build_group_form(&$form, &$form_state) { '#title' => t('Filter identifier'), '#size' => 40, '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), - '#fieldset' => 'more', ); $form['group_info']['label'] = array( '#type' => 'textfield', @@ -909,7 +906,6 @@ function build_group_form(&$form, &$form_state) { '#title' => t('Filter identifier'), '#size' => 40, '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'), - '#fieldset' => 'more', ); $form['group_info']['label'] = array( '#type' => 'textfield', diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc index a723854..9a4fcb9 100644 --- a/core/modules/views_ui/admin.inc +++ b/core/modules/views_ui/admin.inc @@ -275,6 +275,15 @@ function views_ui_pre_render_add_fieldset_markup($form) { } } + // Hide the fieldsets if there is nothing on there. + if (isset($form['#fieldsets'])) { + foreach ($form['fieldsets']['#value'] as $fieldset) { + if (!element_children($form[$fieldset])) { + $form[$fieldset]['#access'] = FALSE; + } + } + } + return $form; }