Drupal 8  8.0.2
LanguageNegotiationSession Class Reference
Inheritance diagram for LanguageNegotiationSession:

Public Member Functions

 getLangcode (Request $request=NULL)
 
 persist (LanguageInterface $language)
 
 processOutbound ($path, &$options=array(), Request $request=NULL, BubbleableMetadata $bubbleable_metadata=NULL)
 
 getLanguageSwitchLinks (Request $request, $type, Url $url)
 
- Public Member Functions inherited from LanguageNegotiationMethodBase
 setLanguageManager (ConfigurableLanguageManagerInterface $language_manager)
 
 setConfig (ConfigFactoryInterface $config)
 
 setCurrentUser (AccountInterface $current_user)
 
 persist (LanguageInterface $language)
 
- Public Member Functions inherited from LanguageSwitcherInterface
 getLanguageSwitchLinks (Request $request, $type, Url $url)
 

Data Fields

const METHOD_ID = 'language-session'
 

Protected Attributes

 $queryRewrite
 
 $queryParam
 
 $queryValue
 
- Protected Attributes inherited from LanguageNegotiationMethodBase
 $languageManager
 
 $config
 
 $currentUser
 

Detailed Description

Identify language from a request/session parameter.

( id = Drupal::METHOD_ID, weight = -6, name = ("Session"), description = ("Language from a request/session parameter."), config_route_name = "language.negotiation_session" )

Member Function Documentation

getLangcode ( Request  $request = NULL)

{Performs language negotiation.

Parameters
\Symfony\Component\HttpFoundation\Request$request(optional) The current request. Defaults to NULL if it has not been initialized yet.
Returns
string A valid language code or FALSE if the negotiation was unsuccessful.
}

Implements LanguageNegotiationMethodInterface.

References Drupal\config().

Here is the call graph for this function:

getLanguageSwitchLinks ( Request  $request,
  $type,
Url  $url 
)

{}

References Drupal\config(), and Drupal\languageManager().

Here is the call graph for this function:

persist ( LanguageInterface  $language)

{Notifies the plugin that the language code it returned has been accepted.

Parameters
\Drupal\Core\Language\LanguageInterface$languageThe accepted language.
}

Implements LanguageNegotiationMethodInterface.

References Drupal\config(), Drupal\currentUser(), LanguageInterface\getId(), and Drupal\languageManager().

Here is the call graph for this function:

processOutbound (   $path,
$options = array(),
Request  $request = NULL,
BubbleableMetadata  $bubbleable_metadata = NULL 
)

{Processes the outbound path.

Parameters
string$pathThe path to process, with a leading slash.
array$options(optional) An associative array of additional options, with the following elements:
  • 'query': An array of query key/value-pairs (without any URL-encoding) to append to the URL.
  • 'fragment': A fragment identifier (named anchor) to append to the URL. Do not include the leading '#' character.
  • 'absolute': Defaults to FALSE. Whether to force the output to be an absolute link (beginning with http:). Useful for links that will be displayed outside the site, such as in an RSS feed.
  • 'language': An optional language object used to look up the alias for the URL. If $options['language'] is omitted, it defaults to the current language for the language type LanguageInterface::TYPE_URL.
  • 'https': Whether this URL should point to a secure location. If not defined, the current scheme is used, so the user stays on HTTP or HTTPS respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
  • 'base_url': Only used internally by a path processor, for example, to modify the base URL when a language dependent URL requires so.
  • 'prefix': Only used internally, to modify the path when a language dependent URL requires so.
  • 'route': The route object for the given path. It will be set by ::generateFromRoute().
\Symfony\Component\HttpFoundation\Request$requestThe HttpRequest object representing the current request.
\Drupal\Core\Render\BubbleableMetadata$bubbleable_metadata(optional) Object to collect path processors' bubbleable metadata.
Returns
string The processed path.
}

Implements OutboundPathProcessorInterface.

References Drupal\config(), Drupal\currentUser(), and Drupal\languageManager().

Here is the call graph for this function:

Field Documentation

const METHOD_ID = 'language-session'

The language negotiation method id.

Referenced by LanguageUILanguageNegotiationTest\testUILanguageNegotiation().


The documentation for this class was generated from the following file: