Entity bundle filter doesn't support

Created on 10 February 2024, 10 months ago
Updated 31 March 2024, 9 months ago

I build a search page by setting up a view. In this view, I create a "Search:Entity bundle" filter criteria, and expose this filter to allow users to change it. I use "Better Exposed Filters" to have more widget options for the filters. The exposed filter widget for the "Search: Entity bundle" is "Default" only, I expect to have more widgets like "Checkboxes/Radio buttons", Links, etc.

After doing some debugging, I found out that the EntityBundleFilter should extend from InOperator in order to have widget options that Better Exposed Filters module supports. Attached bellow is the patch I'm using!

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas

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

Merge Requests

Comments & Activities

  • Issue created by @sea2709
  • πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas
  • πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas
  • πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas
  • πŸ‡ΊπŸ‡ΈUnited States lemming

    @sea2709 thanks for submitting a patch, this does look like a good update and I will include this with a couple updates.

    1. Remove the "use" declaration for "FilterPluginBase" as it is no longer used and is called out by Coder / Codesniffer
    2. Rather than update the EnittyBundleFilter::operators() method you can just remove it and use the parent InOperator::operators()
    3. Same as above with the EntityBundleFIlter::OperatorOptions(), keep the parent version, it makes use of the "$which" parameter which you added by did not implement.
    4. Because the operators being changed to all lowercase "in" and "not in", the default value in "::defineOptions()" needs to be updated.
    5. Because operators are being changes to lowercase, we need to make sure the change is compatible to existing views filters configurations which were created previously. I recommend adding an override to "EntityBundleFilter::init()" method and ensure that the:
      public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
        parent::init($view, $display, $options);
      
        $this->operator = strtolower($this->options["operator"]);
      }
      

      OR

      public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
        $this->options['operator'] = strtolower($filter->options["operator"]);
        parent::init($view, $display, $options);
      }
      
  • Assigned to lemming
  • Status changed to Needs review 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States lemming

    Rolled and updated patch that addresses the issues I mentioned previously.

    I tested with BEF version 6, and tried the variants of the links, select and radio/checkbox types.

  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States lemming
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024