diff --git a/core/modules/views_ui/css/views_ui.admin.theme.css b/core/modules/views_ui/css/views_ui.admin.theme.css index 9a71196..12ea3be 100644 --- a/core/modules/views_ui/css/views_ui.admin.theme.css +++ b/core/modules/views_ui/css/views_ui.admin.theme.css @@ -775,7 +775,6 @@ ul#views-display-menu-tabs li.add ul.action-list li{ */ .views-filterable-options .form-type-checkbox { - border: 1px solid #ccc; padding: 5px 8px; border-top: none; } diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js index b443227..4214710 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -186,7 +186,7 @@ Drupal.viewsUi.AddItemForm = function ($form) { Drupal.viewsUi.AddItemForm.prototype.handleCheck = function (event) { var $target = $(event.target); - var label = $.trim($target.next().text()); + var label = $.trim($target.closest('td').next().text()); // Add/remove the checked item to the list. if ($target.is(':checked')) { this.$selected_div.show().css('display', 'block'); @@ -330,13 +330,14 @@ $.extend(Drupal.viewsUi.OptionsSearch.prototype, { * shown and hidden depending on the user's search terms. */ getOptions: function ($allOptions) { - var i, $label, $description, $option; + var i, $label, $description, $option, $cell; var options = []; var length = $allOptions.length; for (i = 0; i < length; i++) { $option = $($allOptions[i]); - $label = $option.find('label'); - $description = $option.find('div.description'); + $cell = $option.find('td'); + $label = $($cell[1]); + $description = $($cell[2]); options[i] = { // Search on the lowercase version of the label text + description. 'searchText': $label.text().toLowerCase() + " " + $description.text().toLowerCase(), diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php index b45e113..9cec911 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php @@ -103,8 +103,14 @@ public function buildForm(array $form, array &$form_state) { $form['options']['name'] = array( '#prefix' => '
', '#suffix' => '
', + '#type' => 'table', + '#header' => array( + t('Title'), + t('Description'), + t('Category'), + ), + '#tableselect' => TRUE, '#tree' => TRUE, - '#default_value' => 'all', ); // Group options first to simplify the usage of #states. @@ -134,14 +140,8 @@ public function buildForm(array $form, array &$form_state) { foreach ($grouped_options as $group => $group_options) { $zebra = 0; foreach ($group_options as $key => $option) { - $zebra_class = ($zebra % 2) ? 'odd' : 'even'; $form['options']['name'][$key] = array( - '#type' => 'checkbox', - '#title' => $this->t('!group: !field', array('!group' => $option['group'], '!field' => $option['title'])), - '#description' => $option['help'], - '#return_value' => $key, - '#prefix' => "
", - '#suffix' => '
', + '#tree' => TRUE, '#states' => array( 'visible' => array( array( @@ -150,10 +150,23 @@ public function buildForm(array $form, array &$form_state) { array( ':input[name="override[controls][group]"]' => array('value' => $group), ), - ) - ) + ), + ), + '#attributes' => array( + 'class' => array( + 'filterable-option', + ), + ), + ); + $form['options']['name'][$key]['title'] = array( + '#markup' => $option['title'], + ); + $form['options']['name'][$key]['help'] = array( + '#markup' => $option['help'], + ); + $form['options']['name'][$key]['group'] = array( + '#markup' => $option['group'], ); - $zebra++; } }