LanguageNegotiationContentEntity
class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase implements OutboundPathProcessorInterface, LanguageSwitcherInterface, ContainerFactoryPluginInterface (View source)
Class for identifying the content translation language.
Constants
| METHOD_ID |
The language negotiation method ID. |
| QUERY_PARAMETER |
The query string parameter. |
Properties
| protected LanguageManagerInterface | $languageManager | The language manager. |
from LanguageNegotiationMethodBase |
| protected ConfigFactoryInterface | $config | The configuration factory. |
from LanguageNegotiationMethodBase |
| protected AccountInterface | $currentUser | The current active user. |
from LanguageNegotiationMethodBase |
| protected array | $contentEntityPaths | A list of all the link paths of enabled content entities. |
|
| protected bool | $hasLowerLanguageNegotiationWeightResult | Static cache for the language negotiation order check. |
|
| protected SplObjectStorage | $paths | Static cache of outbound route paths per request. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
Methods
Injects the language manager.
Notifies the plugin that the language code it returned has been accepted.
Constructs a new LanguageNegotiationContentEntity instance.
Creates an instance of the plugin.
Performs language negotiation.
Processes the outbound path.
Determines if content entity language negotiator has higher priority.
Determines if content entity route condition is met.
Returns the content entity type ID from the current request for the route.
Returns the paths for the link templates of all content entities.
Details
setLanguageManager(ConfigurableLanguageManagerInterface $language_manager)
Injects the language manager.
setConfig(ConfigFactoryInterface $config)
Injects the configuration factory.
setCurrentUser(AccountInterface $current_user)
Injects the current user.
persist(LanguageInterface $language)
Notifies the plugin that the language code it returned has been accepted.
__construct(EntityTypeManagerInterface $entity_type_manager)
Constructs a new LanguageNegotiationContentEntity instance.
static ContainerFactoryPluginInterface
create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)
Creates an instance of the plugin.
string
getLangcode(Request $request = NULL)
Performs language negotiation.
string
processOutbound(string $path, array $options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL)
Processes the outbound path.
array
getLanguageSwitchLinks(Request $request, string $type, Url $url)
Returns language switch links.
protected bool
hasLowerLanguageNegotiationWeight()
Determines if content entity language negotiator has higher priority.
The content entity language negotiator having higher priority than the url language negotiator, is a criteria in \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::processOutbound().
protected bool
meetsContentEntityRoutesCondition(Route $outbound_route, Request $request)
Determines if content entity route condition is met.
Requirements: currently being on a content entity route and processing outbound url pointing to the same content entity.
protected string
getContentEntityTypeIdForCurrentRequest(Request $request)
Returns the content entity type ID from the current request for the route.
protected array
getContentEntityPaths()
Returns the paths for the link templates of all content entities.