Commit 37a2c6f3 authored by Etroid's avatar Etroid
Browse files

Issue #3152517 by akshay_d: \Drupal::moduleHandler() should be replaced with ModuleHandlerInterface

parent 2b42e73a
......@@ -4,6 +4,7 @@ namespace Drupal\better_exposed_filters\Plugin\views\exposed_form;
use Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetManager;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\SubformState;
use Drupal\Core\Render\Element;
......@@ -45,6 +46,13 @@ class BetterExposedFilters extends InputRequired {
*/
public $sortWidgetManager;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* BetterExposedFilters constructor.
*
......@@ -60,12 +68,15 @@ class BetterExposedFilters extends InputRequired {
* The better exposed filter widget manager for pager widgets.
* @param \Drupal\better_exposed_filters\Plugin\BetterExposedFiltersWidgetManager $sort_widget_manager
* The better exposed filter widget manager for sort widgets.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* Manage drupal modules.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, BetterExposedFiltersWidgetManager $filter_widget_manager, BetterExposedFiltersWidgetManager $pager_widget_manager, BetterExposedFiltersWidgetManager $sort_widget_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, BetterExposedFiltersWidgetManager $filter_widget_manager, BetterExposedFiltersWidgetManager $pager_widget_manager, BetterExposedFiltersWidgetManager $sort_widget_manager, ModuleHandlerInterface $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->filterWidgetManager = $filter_widget_manager;
$this->pagerWidgetManager = $pager_widget_manager;
$this->sortWidgetManager = $sort_widget_manager;
$this->moduleHandler = $module_handler;
}
/**
......@@ -78,7 +89,8 @@ class BetterExposedFilters extends InputRequired {
$plugin_definition,
$container->get('plugin.manager.better_exposed_filters_filter_widget'),
$container->get('plugin.manager.better_exposed_filters_pager_widget'),
$container->get('plugin.manager.better_exposed_filters_sort_widget')
$container->get('plugin.manager.better_exposed_filters_sort_widget'),
$container->get('module_handler')
);
}
......@@ -467,7 +479,7 @@ class BetterExposedFilters extends InputRequired {
}
// Alter the list of available widgets for this filter.
\Drupal::moduleHandler()->alter('better_exposed_filters_display_options', $options, $filter);
$this->moduleHandler->alter('better_exposed_filters_display_options', $options, $filter);
// Get a descriptive label for the filter.
$label = $this->t('Exposed filter @filter', [
......@@ -703,7 +715,7 @@ class BetterExposedFilters extends InputRequired {
// Grab BEF options and allow modules/theme to modify them before
// processing.
$bef_options = $this->options['bef'];
\Drupal::moduleHandler()->alter('better_exposed_filters_options', $bef_options, $this->view, $this->displayHandler);
$this->moduleHandler->alter('better_exposed_filters_options', $bef_options, $this->view, $this->displayHandler);
// Apply auto-submit values.
if (!empty($bef_options['general']['autosubmit'])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment