Commit 59de7895 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2912761 by borisson_: Remove usage of ARRAY_FILTER_USE_KEY because of 5.5

parent 779647c6
...@@ -123,7 +123,6 @@ class FacetForm extends EntityForm { ...@@ -123,7 +123,6 @@ class FacetForm extends EntityForm {
/** @var \Drupal\facets\FacetInterface $facet */ /** @var \Drupal\facets\FacetInterface $facet */
$facet = $this->entity; $facet = $this->entity;
$widget = $facet->getWidgetInstance();
$widget_options = []; $widget_options = [];
foreach ($this->widgetPluginManager->getDefinitions() as $widget_id => $definition) { foreach ($this->widgetPluginManager->getDefinitions() as $widget_id => $definition) {
...@@ -132,11 +131,15 @@ class FacetForm extends EntityForm { ...@@ -132,11 +131,15 @@ class FacetForm extends EntityForm {
// Filters all the available widgets to make sure that only those that // Filters all the available widgets to make sure that only those that
// this facet applies for are enabled. // this facet applies for are enabled.
$widget_options = array_filter($widget_options, function ($widget_id) use ($facet) { foreach ($widget_options as $widget_id => $label) {
$widget = $this->widgetPluginManager->createInstance($widget_id); $widget = $this->widgetPluginManager->createInstance($widget_id);
return $widget->supportsFacet($facet); if (!$widget->supportsFacet($facet)) {
}, ARRAY_FILTER_USE_KEY); unset($widget_options[$widget_id]);
}
}
unset($widget_id, $label, $widget);
$widget = $facet->getWidgetInstance();
$form['widget'] = [ $form['widget'] = [
'#type' => 'radios', '#type' => 'radios',
'#title' => $this->t('Widget'), '#title' => $this->t('Widget'),
...@@ -188,18 +191,22 @@ class FacetForm extends EntityForm { ...@@ -188,18 +191,22 @@ class FacetForm extends EntityForm {
// Filters all the available processors to make sure that only those that // Filters all the available processors to make sure that only those that
// this facet applies for are enabled. // this facet applies for are enabled.
$all_processors = array_filter($all_processors, function ($id) use ($facet) { foreach ($all_processors as $processor_id => $processor) {
$processor = $this->processorPluginManager->createInstance($id, ['facet' => $facet]); if (!$processor->supportsFacet($facet)) {
return $processor->supportsFacet($facet); unset($all_processors[$processor_id]);
}, ARRAY_FILTER_USE_KEY); }
}
unset($processor_id, $processor);
$stages = $this->processorPluginManager->getProcessingStages(); $stages = $this->processorPluginManager->getProcessingStages();
$processors_by_stage = []; $processors_by_stage = [];
foreach ($stages as $stage => $definition) { foreach ($stages as $stage => $definition) {
$processors_by_stage[$stage] = array_filter($facet->getProcessorsByStage($stage, FALSE), function ($id) use ($facet) { foreach ($facet->getProcessorsByStage($stage, FALSE) as $processor_id => $processor) {
$processor = $this->processorPluginManager->createInstance($id, ['facet' => $facet]); if ($processor->supportsFacet($facet)) {
return $processor->supportsFacet($facet); $processors_by_stage[$stage][$processor_id] = $processor;
}, ARRAY_FILTER_USE_KEY); }
}
unset($processor_id, $processor);
} }
$form['#tree'] = TRUE; $form['#tree'] = TRUE;
......
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