"Pass Contextual Filters" option is broken on multiple sorts

Created on 25 January 2023, almost 2 years ago

Problem/Motivation

When 2 or more sorts if used on the view, when first uses "Pass Contextual Filters" and the last has it turned off, arguments aren't used for sorting. All joins in the views query miss "args" field.

Steps to reproduce

Add 2 filters to the view with different "Pass Contextual Filters" configuration. Check views query in the preview. Both uses configuration from the last.

Proposed resolution

The "draggableviews_with_args" join plugin looks for the options in the last DraggableViewsSort sort plugin, but not in the exact one. Pass this option to the sort plugin as configuration and don't lookup across all the view sorts.

User interface changes

No

API changes

I don't include it in patch, but I propose to remove "hook_draggableviews_join_withargs_alter()". The hook is called in the "draggableviews_with_args" views join plugin and its a main part of its functionality. But the join plugin could be altered itself with "join_id" key in views definition, and make necessary changes. I think I'll create a separate issue later to discuss it.

Data model changes

No

πŸ› Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus dewalt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dewalt
  • πŸ‡§πŸ‡ΎBelarus dewalt

    The patch, don't contain API changes, and contain duplicate results fix too inside.

  • Status changed to RTBC over 1 year ago
  • πŸ‡·πŸ‡ΈSerbia SAVEL

    The patch applies and solves the problem. Moving to RTBC

  • πŸ‡ͺπŸ‡ΈSpain bmunslow

    Patch works for me too, looking forward to seeing this included in the next release!

  • First commit to issue fork.
  • Merge request !48Re-rolled patch 2 to latest release. β†’ (Open) created by arparker
  • Pipeline finished with Failed
    about 2 months ago
    Total: 141s
    #359635
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Check the PHPCS test https://git.drupalcode.org/issue/draggableviews-3336466/-/jobs/3595980
    Looks like you need to make some changes

    FILE: ...b/modules/custom/draggableviews-3336466/src/Plugin/views/join/WithArgs.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     27 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 5
        |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
     27 | ERROR | [x] Closing brace indented incorrectly; expected 4 spaces, found
        |       |     5 (Drupal.WhiteSpace.ScopeClosingBrace.Indent)
     37 | ERROR | [x] Whitespace found at end of line
        |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    Time: 213ms; Memory: 6MB
    PHP CODE SNIFFER REPORT SUMMARY
    --------------------------------------------------------------------------------
    FILE                                                            ERRORS  WARNINGS
    --------------------------------------------------------------------------------
    ...m/draggableviews-3336466/src/Plugin/views/join/WithArgs.php  3       0
    --------------------------------------------------------------------------------
    A TOTAL OF 3 ERRORS AND 0 WARNINGS WERE FOUND IN 9 FILES
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX 3 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
    ----------------------------------------------------------------------
        SOURCE                                                       COUNT
    ----------------------------------------------------------------------
    [x] Drupal.WhiteSpace.ScopeClosingBrace.Indent                   1
    [x] Drupal.WhiteSpace.ScopeIndent.IncorrectExact                 1
    [x] Squiz.WhiteSpace.SuperfluousWhitespace.EndLine               1
    ----------------------------------------------------------------------
    A TOTAL OF 3 SNIFF VIOLATIONS WERE FOUND IN 3 SOURCES
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SOURCES AUTOMATICALLY (3 VIOLATIONS IN TOTAL)
    ----------------------------------------------------------------------
    
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    Updated the merge request to address PHPCS errors.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 196s
    #375441
  • Pipeline finished with Failed
    about 1 month ago
    Total: 166s
    #375442
Production build 0.71.5 2024