Unverified Commit 4e4f76c9 authored by alexpott's avatar alexpott
Browse files

Issue #2940121 by apaderno, andypost, idebr, Kingdutch, kala4ek, mfb,...

Issue #2940121 by apaderno, andypost, idebr, Kingdutch, kala4ek, mfb, alexpott, Berdir: ConfigurableLanguageManager::getLanguageSwitchLinks() doesn't respect what LanguageManagerInterface::getLanguageSwitchLinks() says to return

(cherry picked from commit c45aba90)
parent 8417e5ff
...@@ -215,7 +215,7 @@ public function getFallbackCandidates(array $context = []) { ...@@ -215,7 +215,7 @@ public function getFallbackCandidates(array $context = []) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getLanguageSwitchLinks($type, Url $url) { public function getLanguageSwitchLinks($type, Url $url) {
return []; return NULL;
} }
/** /**
......
...@@ -171,8 +171,11 @@ public function getFallbackCandidates(array $context = []); ...@@ -171,8 +171,11 @@ public function getFallbackCandidates(array $context = []);
* @param \Drupal\Core\Url $url * @param \Drupal\Core\Url $url
* The URL the switch links will be relative to. * The URL the switch links will be relative to.
* *
* @return array * @return object|null
* A keyed array of links ready to be themed. * An object with the following keys:
* - links: An array of links indexed by the language ID
* - method_id: The language negotiation method ID
* or NULL if there are no language switch links.
*/ */
public function getLanguageSwitchLinks($type, Url $url); public function getLanguageSwitchLinks($type, Url $url);
......
...@@ -403,8 +403,6 @@ public function getFallbackCandidates(array $context = []) { ...@@ -403,8 +403,6 @@ public function getFallbackCandidates(array $context = []) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getLanguageSwitchLinks($type, Url $url) { public function getLanguageSwitchLinks($type, Url $url) {
$links = FALSE;
if ($this->negotiator) { if ($this->negotiator) {
foreach ($this->negotiator->getNegotiationMethods($type) as $method_id => $method) { foreach ($this->negotiator->getNegotiationMethods($type) as $method_id => $method) {
$reflector = new \ReflectionClass($method['class']); $reflector = new \ReflectionClass($method['class']);
...@@ -422,7 +420,7 @@ public function getLanguageSwitchLinks($type, Url $url) { ...@@ -422,7 +420,7 @@ public function getLanguageSwitchLinks($type, Url $url) {
} }
} }
return $links; return $links ?? NULL;
} }
/** /**
......
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