Commit 5d80b8b8 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2959215 by borisson_: Site crash if language detector method 'Session' is used

parent 42f04e7c
......@@ -8,6 +8,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
......@@ -359,9 +360,8 @@ function facets_language_switch_links_alter(array &$links, $type, Url $url) {
/** @var \Drupal\facets\UrlProcessor\UrlProcessorPluginManager $urlProcessorManager */
$urlProcessorManager = \Drupal::service('plugin.manager.facets.url_processor');
foreach ($links as &$link) {
if (empty($link['language']) || $link['language']->getId() === $language_interface->getId()) {
if (empty($link['language']) || !($link['language'] instanceof LanguageInterface) || $link['language']->getId() === $language_interface->getId()) {
continue;
}
......
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