You are here

interface LanguageNegotiationMethodInterface in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/src/LanguageNegotiationMethodInterface.php \Drupal\language\LanguageNegotiationMethodInterface
  2. 10 core/modules/language/src/LanguageNegotiationMethodInterface.php \Drupal\language\LanguageNegotiationMethodInterface

Interface for language negotiation classes.

Hierarchy

Expanded class hierarchy of LanguageNegotiationMethodInterface

All classes that implement LanguageNegotiationMethodInterface

File

core/modules/language/src/LanguageNegotiationMethodInterface.php, line 13

Namespace

Drupal\language
View source
interface LanguageNegotiationMethodInterface {

  /**
   * Injects the language manager.
   *
   * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
   *   The language manager to be used to retrieve the language list and the
   *   already negotiated languages.
   */
  public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager);

  /**
   * Injects the configuration factory.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
   *   The configuration factory.
   */
  public function setConfig(ConfigFactoryInterface $config);

  /**
   * Injects the current user.
   *
   * @param \Drupal\Core\Session\AccountInterface $current_user
   *   The current active user.
   */
  public function setCurrentUser(AccountInterface $current_user);

  /**
   * Performs language negotiation.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   (optional) The current request. Defaults to NULL if it has not been
   *   initialized yet.
   *
   * @return string
   *   A valid language code or FALSE if the negotiation was unsuccessful.
   */
  public function getLangcode(Request $request = NULL);

  /**
   * Notifies the plugin that the language code it returned has been accepted.
   *
   * @param \Drupal\Core\Language\LanguageInterface $language
   *   The accepted language.
   */
  public function persist(LanguageInterface $language);

}

Members

Namesort descending Modifiers Type Description Overrides
LanguageNegotiationMethodInterface::getLangcode public function Performs language negotiation. 10
LanguageNegotiationMethodInterface::persist public function Notifies the plugin that the language code it returned has been accepted. 1
LanguageNegotiationMethodInterface::setConfig public function Injects the configuration factory. 1
LanguageNegotiationMethodInterface::setCurrentUser public function Injects the current user. 1
LanguageNegotiationMethodInterface::setLanguageManager public function Injects the language manager. 1