Compability issue with BEF 8.x-5.0 and BEF 6.0.3

Created on 27 July 2020, almost 4 years ago
Updated 1 June 2024, 26 days ago

Problem/Motivation

In the Exposed Form options for a view, it's impossible to select Better Exposed Filters (with layout) as it throws the following PHP error:

ArgumentCountError: Too few arguments to function Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters::__construct(), 6 passed in /var/www/modules/contrib/vefl/modules/vefl_bef/src/Plugin/views/exposed_form/VeflBef.php on line 78 and exactly 7 expected in Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters->__construct() (line 74 of /var/www/modules/contrib/better_exposed_filters/src/Plugin/views/exposed_form/BetterExposedFilters.php)

It is due to a change in the newest relases of the Better Exposed Filters module (better_exposed_filters 8.x-5.0-beta1, better_exposed_filters 8.x-4.0-beta2).

In the latest release of BEF, class BetterExposedFilters implemented Drupal's ModuleHandlerInterface as a 7th argument, which break VeflBef.

Steps to reproduce

Install module VEFL (8.x-3.0) with module BetterExposedFilters (8.x-5.0-beta1).
Create a view that uses an exposed form and select "Better Exposed Filters (with layout)" as the exposed form style.

🐛 Bug report
Status

RTBC

Version

3.1

Component

Code

Created by

🇨🇦Canada emixaam

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada dshields

    Patch #2 works!

  • First commit to issue fork.
  • Merge request !1Resolve #3161777 "Vefl" → (Open) created by urvashi_vora
  • 🇷🇸Serbia krug

    Drupal Version: 8.9.20
    Better Exposed Filters better_exposed_filters 8.x-5.2
    Views exposed form layout vefl_bef 8.x-3.0
    Patch #2 works for me.
    @emixaam, thanks.

  • 🇺🇸United States crutch

    Unable to install vefl because requirement "Better Exposed Filters (>=8.x-4.x) (incompatible with version * ? *)"

    D 9.5.9
    BEF 6.0.3
    VEFL 8.x-3.0

  • 🇦🇹Austria maxilein

    This error also happens on

    D 10.2.3
    BEF 6.0.3
    VEFL 8.x-3.1

    Does the patch also work with BEF 6?

  • 🇦🇹Austria maxilein

    Changed because the patch works for BEF 6.0.3 also.

  • 🇷🇸Serbia krug

    Drupal Version: 10.2.2
    VEFL: 8.x-3.1
    BEF: 6.0.3
    Patch #2 works for me.
    @emixaam, thanks.

  • 🇹🇷Turkey Orkut Murat Yılmaz

    Drupal Version: 10.2.2
    VEFL: 8.x-3.1
    BEF: 6.0.3
    DB: PostgreSQL 15.6

    Patch #2 works for me as well:)

    Any chance for merge?

  • 🇵🇹Portugal jrochate

    What about this issue 🐛 Compability issue with BEF 6.0.3 Needs review ? The patch it's similar but a few more instructions.

  • 🇨🇳China jungle Chongqing, China

    Every time the BEF module changes the signature of __construct(), this module breaks. So I would suggest keeping __construct() untouched. And inject the vefl.layout service in create(), see the code snippet below, with this approach, 🐛 Compability issue with BEF 6.0.3 Needs review is a duplicate to me.

      /**
       * The vefl layout helper.
       *
       * @var \Drupal\vefl\Vefl
       */
      protected $vefl;
    
      /**
       * {@inheritdoc}
       */
      public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
        $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
        $instance->vefl = $container->get('vefl.layout');
        return $instance;
      }
    
  • Status changed to Needs work 2 months ago
  • 🇨🇳China jungle Chongqing, China
  • Status changed to Needs review 2 months ago
  • 🇦🇹Austria maxilein

    #23 fixed it for me.
    D10.2.5
    php8.1

    I had the following recent error. #2 did not work any longer.

    ArgumentCountError: Too few arguments to function Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters::__construct(), 7 passed in /.../web/modules/contrib/vefl/modules/vefl_bef/src/Plugin/views/exposed_form/VeflBef.php on line 89 and exactly 8 expected in Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters->__construct() (line 84 of /.../web/modules/contrib/better_exposed_filters/src/Plugin/views/exposed_form/BetterExposedFilters.php).

  • 🇺🇸United States castella

    #23 fixed it for me as well.
    Attached is a patch file to use in the meantime.

  • 🇩🇪Germany NWOM

    #23 and #25 both wouldn't apply for me. Here is a new patch that works against 8x-3.1

  • Status changed to RTBC 26 days ago
  • 🇹🇷Turkey Orkut Murat Yılmaz

    I'm changing the status as RTBC. Thanks for the patch.

Production build 0.69.0 2024