public function LanguageSelectionPageConditionType::getDestination in Language Selection Page 8.2
Find the destination to redirect the user to after choosing the language.
Parameters
string $destination: The destination.
Return value
string The destination.
Overrides LanguageSelectionPageConditionBase::getDestination
File
- src/
Plugin/ LanguageSelectionPageCondition/ LanguageSelectionPageConditionType.php, line 158
Class
- LanguageSelectionPageConditionType
- Class for the Type condition plugin.
Namespace
Drupal\language_selection_page\Plugin\LanguageSelectionPageConditionCode
public function getDestination($destination) {
// @todo update this using the config passed to the plugin.
$config = $this->configFactory
->get('language_selection_page.negotiation');
$request = $this->requestStack
->getCurrentRequest();
// If we display the LSP on a page, we must check
// if the destination parameter is correctly set.
if ($config
->get('type') !== 'block') {
if (!empty($request
->getQueryString())) {
list(, $destination) = explode('=', $request
->getQueryString(), 2);
$destination = urldecode($destination);
}
}
else {
$destination = $request
->getPathInfo();
}
return $destination;
}