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 cfd99ac..c58d87a 100644 --- a/core/modules/views_ui/css/views_ui.admin.theme.css +++ b/core/modules/views_ui/css/views_ui.admin.theme.css @@ -795,7 +795,6 @@ td.group-title { */ .views-filterable-options .form-type-checkbox { - border: 1px solid #ccc; padding: 5px 8px; border-top: none; } @@ -804,10 +803,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 b4a1c91..04aa848 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -192,7 +192,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'); @@ -336,13 +336,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 95b3fd0..8e61ec1 100644 --- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php @@ -103,8 +103,15 @@ 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,12 +141,7 @@ public function buildForm(array $form, array &$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( @@ -148,8 +150,20 @@ public function buildForm(array $form, array &$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'], + ), ); } }