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 7ac952d..4ef9bfc 100644 --- a/core/modules/views_ui/css/views_ui.admin.theme.css +++ b/core/modules/views_ui/css/views_ui.admin.theme.css @@ -749,7 +749,6 @@ td.group-title { */ .views-filterable-options .form-type-checkbox { - border: 1px solid #ccc; padding: 5px 8px; border-top: none; } @@ -758,10 +757,6 @@ td.group-title { border-top: 1px solid #ccc; } -.views-filterable-options .filterable-option:nth-of-type(even) .form-type-checkbox { - background-color: #f3f4ee; -} - .filterable-option .form-item { margin-bottom: 0; margin-top: 0; diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js index 2d197a9..bc3636f 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -191,7 +191,7 @@ 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'); @@ -335,13 +335,14 @@ * 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/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php index afcfa43..2293005 100644 --- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php @@ -104,8 +104,15 @@ public function buildForm(array $form, FormStateInterface $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. @@ -135,12 +142,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { foreach ($grouped_options as $group => $group_options) { foreach ($group_options as $key => $option) { $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( @@ -149,8 +151,20 @@ public function buildForm(array $form, FormStateInterface $form_state) { array( ':input[name="override[controls][group]"]' => array('value' => $group), ), - ) - ) + ), + ), + '#attributes' => array( + 'class' => array('filterable-option'), + ), + 'title' => array( + '#markup' => $option['title'], + ), + 'help' => array( + '#markup' => $option['help'], + ), + 'group' => array( + '#markup' => $option['group'], + ), ); } }