class SocialLanguageMetadataBubblingUrlGenerator in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.2 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.3 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.4 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.5 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.6 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 8.7 modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 10.3.x modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 10.0.x modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 10.1.x modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
- 10.2.x modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
Class SocialLanguageMetadataBubblingUrlGenerator.
@package Drupal\social_language
Hierarchy
- class \Drupal\Core\Render\MetadataBubblingUrlGenerator implements UrlGeneratorInterface
- class \Drupal\social_language\SocialLanguageMetadataBubblingUrlGenerator
Expanded class hierarchy of SocialLanguageMetadataBubblingUrlGenerator
Deprecated
in Open Social 8.x and will be removed before 9.0.
See also
https://www.drupal.org/project/social/issues/3098046
File
- modules/
custom/ social_language/ src/ SocialLanguageMetadataBubblingUrlGenerator.php, line 18
Namespace
Drupal\social_languageView source
class SocialLanguageMetadataBubblingUrlGenerator extends MetadataBubblingUrlGenerator {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a new bubbling URL generator service.
*
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The non-bubbling URL generator.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(UrlGeneratorInterface $url_generator, RendererInterface $renderer, LanguageManagerInterface $language_manager) {
parent::__construct($url_generator, $renderer);
$this->languageManager = $language_manager;
}
/**
* {@inheritdoc}
*/
public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) {
if (isset($options['language']) && $options['language'] instanceof LanguageInterface) {
$language = $this->languageManager
->getCurrentLanguage();
if ($options['language']
->getId() != $language
->getId()) {
$reset_language = TRUE;
$unmodified_pages = [
'content_translation_overview',
];
$current_route = \Drupal::routeMatch()
->getRouteName();
\Drupal::moduleHandler()
->alter('social_language_unmodified_pages', $unmodified_pages);
$route_parts = explode('.', $current_route);
foreach ($unmodified_pages as $page) {
if (in_array($page, $route_parts)) {
$reset_language = FALSE;
break;
}
}
if ($reset_language) {
$options['language'] = $language;
}
}
}
return parent::generateFromRoute($name, $parameters, $options, $collect_bubbleable_metadata);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MetadataBubblingUrlGenerator:: |
protected | property | The renderer. | |
MetadataBubblingUrlGenerator:: |
protected | property | The non-bubbling URL generator. | |
MetadataBubblingUrlGenerator:: |
protected | function | Bubbles the bubbleable metadata to the current render context. | |
MetadataBubblingUrlGenerator:: |
public | function | Generates a URL or path for a specific route based on the given parameters. | |
MetadataBubblingUrlGenerator:: |
public | function | Gets the request context. | |
MetadataBubblingUrlGenerator:: |
public | function |
Gets the internal path (system path) for a route. Overrides UrlGeneratorInterface:: |
|
MetadataBubblingUrlGenerator:: |
public | function | Convert a route identifier (name, content object etc) into a string usable for logging and other debug/error messages | |
MetadataBubblingUrlGenerator:: |
public | function | Sets the request context. | |
MetadataBubblingUrlGenerator:: |
public | function | Whether this generator supports the supplied $name. | |
SocialLanguageMetadataBubblingUrlGenerator:: |
protected | property | The language manager. | |
SocialLanguageMetadataBubblingUrlGenerator:: |
public | function |
Generates a URL or path for a specific route based on the given parameters. Overrides MetadataBubblingUrlGenerator:: |
|
SocialLanguageMetadataBubblingUrlGenerator:: |
public | function |
Constructs a new bubbling URL generator service. Overrides MetadataBubblingUrlGenerator:: |