Problem/Motivation

We do not have any coverage for field grouping functionality.

Proposed resolution

Add at least basic coverage.

Remaining tasks

Do it.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Manuel Garcia created an issue. See original summary.

manuel garcia’s picture

Status: Active » Needs review
StatusFileSize
new9.51 KB

Here is a start with a test view using grouping options. I believe this will fail because of missing schema definition for use-grouping-header, which will be the first thing we need to fix here. This was originally brought up here #3025278: use-grouping-header missing in schema.

Status: Needs review » Needs work

The last submitted patch, 2: 3035375-2.patch, failed testing. View results

manuel garcia’s picture

OK this is turning out to be a lot trickier than expected...

The thing is since we need to add this field to every Grouping field, then this configuration is saved as part of the views schema for grouping, i.e. display.default.display_options.style.options.grouping.0.use-grouping-header.

The schema for this type of configuration is defined by views itself as part of the views_style schema:

views_style:
  type: mapping
  mapping:
    grouping:
      type: sequence
      label: 'Grouping field number %i'
      sequence:
        type: mapping
        label: 'Field'
        mapping:
          field:
            type: string
            label: 'Field'
          rendered:
            type: boolean
            label: 'Use rendered output to group rows'
          rendered_strip:
            type: boolean
            label: 'Remove tags from rendered output'

(see core/modules/views/config/schema/views.data_types.schema.yml)

So, we need to add another entry to the grouping sequence mapping... if that's even possible :)

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new714 bytes
new10.21 KB

Let's see if this would work (thanks @vijaycs85 for the tip)

Status: Needs review » Needs work

The last submitted patch, 6: 3035375-5.patch, failed testing. View results

vijaycs85’s picture

Status: Needs work » Needs review
StatusFileSize
new88.91 KB
new10.38 KB
new767 bytes

@Manuel Garcia, turns out it was a content type issue than the schema structure. It's green locally, but I think we should update the plugin to use boolean as it's a checkbox input.

manuel garcia’s picture

StatusFileSize
new4.12 KB
new13.35 KB

Excellent news @vijaycs85 thanks so much for looking into this!

About using boolean in the schema, I tried that but apparently form checkboxes are saved as int values, so unfortunately we cant... #drupalwtf.

Adding basic test coverage here for the grouping functionality now :yay:

  • Manuel Garcia committed 1a4bfc6 on 8.x-1.x
    Issue #3035375 by Manuel Garcia, vijaycs85: Add test coverage for field...
manuel garcia’s picture

Status: Needs review » Fixed

This is good enough for now, we can always expand on it later.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gaborkurucz’s picture

StatusFileSize
new2.77 KB
new15.22 KB

Hi!

I couldn't apply patch #9 to the latest stable version because this commit:

https://git.drupalcode.org/project/views_accordion/commit/cae7ecf080cbc0...

wasn't included in the patches. I created a new patch which also includes the above mentioned commit. I was led here because of this issue: https://www.drupal.org/project/views_accordion/issues/3025278 and we'd like to use the stable version with the patch applied instead of the dev version.

Thank you for the module!

manuel garcia’s picture

Hi @gaborkurucz - I have just cut a new 8.x-1.3 release which should make your life easier, as it wont require the patch.

gaborkurucz’s picture

Thanks! That is indeed very good news. :)