Secondary option displays incorrectly after version 6.0.3

Created on 3 May 2024, 7 months ago
Updated 17 September 2024, about 2 months ago

Problem/Motivation

I have several filters placed into the secondary options and they work fine with version 6.0.3 but when i upgraded to 6.0.4 and 6.0.5, they stopped working and just show in the normal location and the "Advanced options" section is blank! I switched back to version 6.0.3 and they display fine again so it appears that version 6.0.4 and 6.0.5 broke this feature.

FYI, I'm using the Drupal8 W3CSS Sub-theme 2.0.13 (d8w3css) theme @ https://www.drupal.org/project/d8w3css; โ†’ in case that's helpful.

I've attached some screen shots showing my settings for one of the filters:

๐Ÿ› Bug report
Status

Needs work

Version

7.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @monaw
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    We are still using 6.0.x-dev at the moment. After an update, we are experiencing similar but only for date exposed filter that had "Make filter options collapsible" checked. The date field was collapsible within the secondary option. When unchecking "Make filter options collapsible" the date field then falls back under secondary option but it can't be collapsible.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So don't have much time to actively work on this module but will happily review any suggestions.

  • Status changed to Postponed: needs info 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So tried replicating on a fresh install on 7.0.x and Drupal 10.3.x

    Using the test module provided to check
    In the view checked Enable secondary exposed form options
    Then enabled a date field and taxonomy field to be secondary options
    They appear fine.

    Tested collapsible feature on another field and that rendered fine too.

    Can you provide additional details.,

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Thank you we will try to move from 6.0.x-dev to 7.0.x this week which sounds like it will fix this issue.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Just make sure to read the release notes. Really only difference is jquery modules are removed so if youโ€™re using them youโ€™ll have to include in your composer file.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Hi, I tried 7.0.x-dev in development. Getting the same result.

    We do have another View with a date exposed filter where no filters are secondary. If it is collapsible, the date filter is the first filter even though it is ordered to be the last.

    When editing the View filters, it is last. When editing BEF in the View, it is last. But for the visitor it displays first. We are using Layout Builder and Claro for these displays, Drupal 10.2.6.

    Unchecking collapsible puts it back in the right spot. This seems to be an issue with the date field or it maybe being a composite field.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States npcoder

    I updated Drupal core to 10.2.6 with contributed modules as well. I figured out that the Better Exposed Filters module caused the problem - Secondary option displays.

    I reverted to 6.0.3, which works as before.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    I'm still not able to replicate on 7.0.x. can the steps be written out vs in screenshots please.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    I'll try and help with an example. Let me know if needing something different.

    This is for reporting Metrics which are displayed with the Claro theme. Claro is the admin theme, but we are using the Theme Switcher module to also use Claro for metrics displays.

    There are more taxonomy fields but they are excluded in the example below.

    Content Types
    - Course - the base course information (body), some other long text fields, image, etc.
    - Course Schedule - a time based event containing fields for schedule (date), participants (integer), select Course (entity reference), etc.

    Format: Table
    Header: Global results summary
    Relationships: field_select_content (reverse)
    Use aggregation: No
    Caching: Time-based:12 hours/12 hours

    Fields:
    - Content: Title (Course)
    - (field_select_content) Content: Title (Schedule)
    - (field_select_content) Content: Actual (Participants)
    - (field_select_content) Content: College Affiliation (College Affiliation)
    - (field_select_content) Content: Schedule (Class Schedule)

    Filter criteria:
    - Content: Content type (= Course)
    - Content: Title (exposed)
    - (field_select_content) Content: College Affiliation (field_college_affiliation) (ef) (exposed)
    - (field_select_content) Content: Schedule (exposed)
    - (field_select_content) Content: Schedule:delta (= 0)
    - (field_select_content) Content: Instructor(s):delta (= 0)

    Exposed form:
    type: bef
    options:
    submit_button: Apply
    reset_button: true
    reset_button_label: Reset
    exposed_sorts_label: 'Sort by'
    expose_sort_order: true
    sort_asc_label: Asc
    sort_desc_label: Desc
    text_input_required: 'Select any filter and click on Apply to see results'
    text_input_required_format: basic_html
    bef:
    general:
    autosubmit: false
    autosubmit_exclude_textfield: false
    autosubmit_textfield_delay: 500
    autosubmit_hide: false
    input_required: false
    allow_secondary: true
    secondary_label: Filters
    secondary_open: false
    reset_button_always_show: false
    filter:
    title:
    plugin_id: default
    advanced:
    placeholder_text: ''
    collapsible: false
    collapsible_disable_automatic_open: false
    is_secondary: true
    field_schedule_value:
    plugin_id: bef_datepicker
    advanced:
    collapsible: false
    collapsible_disable_automatic_open: false
    is_secondary: true
    field_college_affiliation_target_id_entityreference_filter:
    plugin_id: default
    advanced:
    sort_options: false
    rewrite:
    filter_rewrite_values: '- Any -|All'
    filter_rewrite_values_key: false
    collapsible: false
    collapsible_disable_automatic_open: false
    is_secondary: true

    I used config sync to export the BEF settings. When looking at that it seems that "Schedule" is ordered before "College Affiliation" which isn't the order of the exposed filters, but that may not have any bearing. When editing BEF settings the order is correct.

  • I've noticed the same issue trying to update past 6.0.3.

    How to recreate:

    1. https://simplytest.me/ 7.0.0-beta1
    2. Enable the archive view at /admin/structure/views/view/archive/enable
    3. Edit the archive view at /admin/structure/views/view/archive
    4. Under filter criteria set both filters to " Expose this filter to visitors, to allow them to change it" and allow multiple for translation filter
    5. Turn on Better Exposed Filters for the view
    6. Edit Better Exposed Filters settings
    7. Check "Enable secondary exposed form options"
    8. Set Translation language to "Exposed filter widget" as "Checkboxes"
    9. Under advanced filter options for Translation language field check " Make filter options collapsible" and "This is a secondary option"
    10. Try to apply and get an Ajax error, I've attached what it looks like testing locally not on simplytest.me below.

    The secondary option for the Translation language field is appearing outside the secondary options even though it is set as a secondary option.

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Still not able to replicate so any fix will need a test showing it also.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe this is turning into a support request. Pretty sure we have tests around this already

  • Have you tried running through these steps on simplytest.me https://www.drupal.org/project/better_exposed_filters/issues/3444996#com... ๐Ÿ› Secondary option displays incorrectly after version 6.0.3 Needs work ? If you do, you can't even complete the task because of errors like `TypeError: Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetBase::setViewsHandler(): Argument #1 ($handler) must be of type Drupal\views\Plugin\views\ViewsHandlerInterface, null given, called in /var/lib/tugboat/stm/web/modules/contrib/better_exposed_filters/src/Plugin/views/exposed_form/BetterExposedFilters.php on line 598 in Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetBase->setViewsHandler() (line 76 of /var/lib/tugboat/stm/web/modules/contrib/better_exposed_filters/src/Plugin/BetterExposedFiltersWidgetBase.php).`. I also tried writing a test for this but I couldn't my local chromedriver running. Maybe we could jump on a zoom call or Drupal slack huddle and I could show you?

  • I've run through the testing instructions on https://www.drupal.org/project/better_exposed_filters/issues/3444996#com... ๐Ÿ› Secondary option displays incorrectly after version 6.0.3 Needs work and compared it to the bef_test view in the tests and noticed that this error is only happening for blocks. I think the testSecondaryOptions function would fail if this test was being run on a block: https://git.drupalcode.org/project/better_exposed_filters/-/blob/7.0.x/t....

  • I've updated the view config in https://git.drupalcode.org/issue/better_exposed_filters-3444996/-/commit... to illustrate how the secondary filters are appearing outside the advanced options toggle. I hope that you are able to import the config and see the issue in the attached screenshot.

  • @smustgrave - i just noticed that you tried with D10.3 and you said it works while I'm running D10.2.7 and @crutch and @npcoder are running D10.2.6...perhaps a combination of 10.2 and > 6.0.3 is the problem?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    ...just to make sure, for us the 7.0.x-dev version from June 11, 2024 and 10.2.6 is still an issue.

    Our original issue started after 6.0.3 and after we updated Drupal core to 10.2.6. Maybe there is some core or other dependency that changed? It seems to be JS or layout related.

    This example are collapsible (fields) within a collapsible area (secondary).

    • Secondary options are collapsible.
    • Upon checking "Make filter options collapsible" for the Start Date and End Date fields,
    • they then display outside and in front of the collapsible area (secondary).
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    If someone wants to write a fix and test case would happily review but personally don't have time to dig into it.

  • Status changed to Needs review 2 months ago
  • @smustgrave I have added a fix and a test case to https://git.drupalcode.org/issue/better_exposed_filters-3444996/-/compar... if you have time to review.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Just an fyi you have to open merge requests for reviews and the pipeline to run.

  • Status changed to Needs work about 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    test only feature passes when it should fail

  • Pipeline finished with Success
    about 2 months ago
    Total: 266s
    #285630
  • Pipeline finished with Failed
    about 2 months ago
    Total: 232s
    #285650
  • Thanks for taking a look @smustgrave. I removed my code suggestion from FilterWidgetBase.php and updated the test to use assertTrue to hopefully show that the field_bef_integer_value is not appearing in the secondary options.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Thanks but you actually don't have to pull your code out. Gitlab has a test-only feature that runs just the tests without the fix. Added back your fix. If someone who's experiencing this though could verify it fixed it for them.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    I tested and it puts it back within the collapsible secondary. However, the order is not consistent with "Filter criteria" order. When editing BEF, the order is correct, but not when displayed. Images show testing of the Start and End Date fields, making them collapsible within secondary.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • I am not able to recreate that weight issue @crutch. What version of Drupal are you running and could you provide the yml of the view you are using?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    10.2.6

    @block_2 is the one testing

  • Thanks @crutch. I am still unable to replicate the issue that you are having. Testing this on my 10.2.8 version and the bef_test module on Drupal 11, it fixes the issue that I had with the secondary filters and the weight issue with fields marked secondary and collapsible.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Hi bspeare, thanks for your work on this. We can work around it, it's not a big issue for us.

    In dev I upgraded to 10.3.4, tried https://git.drupalcode.org/issue/better_exposed_filters-3444996/-/tree/2... and getting same result as #30.

    When inspecting the output, " filters" are coming before the other "

    filters".
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So would we say this is good to go?

  • I'd vote that we get this fix in and maybe we could create a follow-up issue regarding the order/weight of the details within the secondary options.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    If itโ€™s ordering should be something thatโ€™s pretty easy to fix here.

  • I'm unable to reproduce the ordering issue with the collapsible secondary fields. Is anyone else able to reproduce the issue that @crutch is having in https://www.drupal.org/project/better_exposed_filters/issues/3444996#com... ๐Ÿ› Secondary option displays incorrectly after version 6.0.3 Needs work ?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Tried to reproduce again and I actually can't. @crutch if you're still seeing after next release lets open a new ticket with all the info you can give.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Sure thing, sounds good, thank you

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

Production build 0.71.5 2024