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

merge-requests/1602/head
Alex Pott 2021-12-31 16:35:07 +00:00
parent 9629d09d40
commit c45aba90e8
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
3 changed files with 7 additions and 6 deletions

View File

@ -215,7 +215,7 @@ class LanguageManager implements LanguageManagerInterface {
* {@inheritdoc}
*/
public function getLanguageSwitchLinks($type, Url $url) {
return [];
return NULL;
}
/**

View File

@ -171,8 +171,11 @@ interface LanguageManagerInterface {
* @param \Drupal\Core\Url $url
* The URL the switch links will be relative to.
*
* @return array
* A keyed array of links ready to be themed.
* @return object|null
* 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);

View File

@ -403,8 +403,6 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
* {@inheritdoc}
*/
public function getLanguageSwitchLinks($type, Url $url) {
$links = FALSE;
if ($this->negotiator) {
foreach ($this->negotiator->getNegotiationMethods($type) as $method_id => $method) {
$reflector = new \ReflectionClass($method['class']);
@ -422,7 +420,7 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
}
}
return $links;
return $links ?? NULL;
}
/**