Skip to content
Snippets Groups Projects
Commit 426bcc3b authored by catch's avatar catch
Browse files

Issue #2894449 by benjy, alexpott, _utsavsharma, B-Prod, benjifisher: ...

Issue #2894449 by benjy, alexpott, _utsavsharma, B-Prod, benjifisher:  Indirect modification of overloaded element with Views responsive table
parent 724c8d4d
No related branches found
No related tags found
40 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.
Pipeline #25884 failed
Pipeline: drupal

#25892

    Pipeline: drupal

    #25891

      Pipeline: drupal

      #25890

        +1
        ...@@ -224,6 +224,27 @@ public function testGrouping() { ...@@ -224,6 +224,27 @@ public function testGrouping() {
        } }
        } }
        /**
        * Tests responsive classes and column assigning.
        */
        public function testResponsiveMergedColumns() {
        /** @var \Drupal\views\ViewEntityInterface $view */
        $view = \Drupal::entityTypeManager()->getStorage('view')->load('test_table');
        // Merge the two job columns together and set the responsive priority on
        // the column that is merged to.
        $display = &$view->getDisplay('default');
        $display['display_options']['style']['options']['columns']['job'] = 'job_1';
        $display['display_options']['style']['options']['info']['job_1']['separator'] = ', ';
        $display['display_options']['style']['options']['info']['job_1']['responsive'] = 'priority-low';
        $view->save();
        // Ensure that both columns are properly combined.
        $this->drupalGet('test-table');
        $this->assertSession()->elementExists('xpath', '//tbody/tr/td[contains(concat(" ", @class, " "), " priority-low views-field views-field-job views-field-job-1 ")]');
        $this->assertSession()->elementExists('xpath', '//tbody/tr/td[contains(., "Drummer, Drummer")]');
        }
        /** /**
        * Tests the cacheability of the table display. * Tests the cacheability of the table display.
        */ */
        ......
        ...@@ -501,19 +501,19 @@ function template_preprocess_views_view_table(&$variables) { ...@@ -501,19 +501,19 @@ function template_preprocess_views_view_table(&$variables) {
        $variables['header'][$field]['default_classes'] = $fields[$field]->options['element_default_classes']; $variables['header'][$field]['default_classes'] = $fields[$field]->options['element_default_classes'];
        // Set up the header label class. // Set up the header label class.
        $variables['header'][$field]['attributes'] = []; $variables['header'][$field]['attributes'] = new Attribute();
        $class = $fields[$field]->elementLabelClasses(0); $class = $fields[$field]->elementLabelClasses(0);
        if ($class) { if ($class) {
        $variables['header'][$field]['attributes']['class'][] = $class; $variables['header'][$field]['attributes']->addClass($class);
        } }
        // Add responsive header classes. // Add responsive header classes.
        if (!empty($options['info'][$field]['responsive'])) { if (!empty($options['info'][$field]['responsive'])) {
        $variables['header'][$field]['attributes']['class'][] = $options['info'][$field]['responsive']; $variables['header'][$field]['attributes']->addClass($options['info'][$field]['responsive']);
        $responsive = TRUE; $responsive = TRUE;
        } }
        // Add a CSS align class to each field if one was set. // Add a CSS align class to each field if one was set.
        if (!empty($options['info'][$field]['align'])) { if (!empty($options['info'][$field]['align'])) {
        $variables['header'][$field]['attributes']['class'][] = Html::cleanCssIdentifier($options['info'][$field]['align']); $variables['header'][$field]['attributes']->addClass(Html::cleanCssIdentifier($options['info'][$field]['align']));
        } }
        // Add a header label wrapper if one was selected. // Add a header label wrapper if one was selected.
        if ($variables['header'][$field]['content']) { if ($variables['header'][$field]['content']) {
        ...@@ -522,7 +522,7 @@ function template_preprocess_views_view_table(&$variables) { ...@@ -522,7 +522,7 @@ function template_preprocess_views_view_table(&$variables) {
        $variables['header'][$field]['wrapper_element'] = $element_label_type; $variables['header'][$field]['wrapper_element'] = $element_label_type;
        } }
        // Improves accessibility of complex tables. // Improves accessibility of complex tables.
        $variables['header'][$field]['attributes']['id'] = Html::getUniqueId('view-' . $field . '-table-column'); $variables['header'][$field]['attributes']->setAttribute('id', Html::getUniqueId('view-' . $field . '-table-column'));
        } }
        // aria-sort is a WAI-ARIA property that indicates if items in a table // aria-sort is a WAI-ARIA property that indicates if items in a table
        // or grid are sorted in ascending or descending order. See // or grid are sorted in ascending or descending order. See
        ...@@ -535,8 +535,6 @@ function template_preprocess_views_view_table(&$variables) { ...@@ -535,8 +535,6 @@ function template_preprocess_views_view_table(&$variables) {
        if (!empty($variables['header'][$field]['content'])) { if (!empty($variables['header'][$field]['content'])) {
        $has_header_labels = TRUE; $has_header_labels = TRUE;
        } }
        $variables['header'][$field]['attributes'] = new Attribute($variables['header'][$field]['attributes']);
        } }
        // Add a CSS align class to each field if one was set. // Add a CSS align class to each field if one was set.
        ...@@ -564,21 +562,24 @@ function template_preprocess_views_view_table(&$variables) { ...@@ -564,21 +562,24 @@ function template_preprocess_views_view_table(&$variables) {
        // Add field classes. // Add field classes.
        if (!isset($column_reference['attributes'])) { if (!isset($column_reference['attributes'])) {
        $column_reference['attributes'] = []; $column_reference['attributes'] = new Attribute();
        }
        elseif (!($column_reference['attributes'] instanceof Attribute)) {
        $column_reference['attributes'] = new Attribute($column_reference['attributes']);
        } }
        if ($classes = $fields[$field]->elementClasses($num)) { if ($classes = $fields[$field]->elementClasses($num)) {
        $column_reference['attributes']['class'][] = $classes; $column_reference['attributes']->addClass(preg_split('/\s+/', $classes));
        } }
        // Add responsive header classes. // Add responsive header classes.
        if (!empty($options['info'][$field]['responsive'])) { if (!empty($options['info'][$field]['responsive'])) {
        $column_reference['attributes']['class'][] = $options['info'][$field]['responsive']; $column_reference['attributes']->addClass($options['info'][$field]['responsive']);
        } }
        // Improves accessibility of complex tables. // Improves accessibility of complex tables.
        if (isset($variables['header'][$field]['attributes']['id'])) { if (isset($variables['header'][$field]['attributes']['id'])) {
        $column_reference['attributes']['headers'] = [$variables['header'][$field]['attributes']['id']]; $column_reference['attributes']->setAttribute('headers', [$variables['header'][$field]['attributes']['id']]);
        } }
        if (!empty($fields[$field])) { if (!empty($fields[$field])) {
        ...@@ -604,7 +605,6 @@ function template_preprocess_views_view_table(&$variables) { ...@@ -604,7 +605,6 @@ function template_preprocess_views_view_table(&$variables) {
        } }
        } }
        } }
        $column_reference['attributes'] = new Attribute($column_reference['attributes']);
        } }
        // Remove columns if the "empty_column" option is checked and the // Remove columns if the "empty_column" option is checked and the
        ......
        • catch @catch

          mentioned in commit 532841c6

          ·

          mentioned in commit 532841c6

          Toggle commit list
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment