Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\language;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Config\ConfigFactoryInterface;
|
Chris@0
|
6 use Drupal\Core\Language\LanguageInterface;
|
Chris@0
|
7 use Drupal\Core\Session\AccountInterface;
|
Chris@0
|
8 use Symfony\Component\HttpFoundation\Request;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Interface for language negotiation classes.
|
Chris@0
|
12 */
|
Chris@0
|
13 interface LanguageNegotiationMethodInterface {
|
Chris@0
|
14
|
Chris@0
|
15 /**
|
Chris@0
|
16 * Injects the language manager.
|
Chris@0
|
17 *
|
Chris@0
|
18 * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
|
Chris@0
|
19 * The language manager to be used to retrieve the language list and the
|
Chris@0
|
20 * already negotiated languages.
|
Chris@0
|
21 */
|
Chris@0
|
22 public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager);
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Injects the configuration factory.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @param \Drupal\Core\Config\ConfigFactoryInterface $config
|
Chris@0
|
28 * The configuration factory.
|
Chris@0
|
29 */
|
Chris@0
|
30 public function setConfig(ConfigFactoryInterface $config);
|
Chris@0
|
31
|
Chris@0
|
32 /**
|
Chris@0
|
33 * Injects the current user.
|
Chris@0
|
34 *
|
Chris@0
|
35 * @param \Drupal\Core\Session\AccountInterface $current_user
|
Chris@0
|
36 * The current active user.
|
Chris@0
|
37 */
|
Chris@0
|
38 public function setCurrentUser(AccountInterface $current_user);
|
Chris@0
|
39
|
Chris@0
|
40 /**
|
Chris@0
|
41 * Performs language negotiation.
|
Chris@0
|
42 *
|
Chris@0
|
43 * @param \Symfony\Component\HttpFoundation\Request $request
|
Chris@0
|
44 * (optional) The current request. Defaults to NULL if it has not been
|
Chris@0
|
45 * initialized yet.
|
Chris@0
|
46 *
|
Chris@0
|
47 * @return string
|
Chris@0
|
48 * A valid language code or FALSE if the negotiation was unsuccessful.
|
Chris@0
|
49 */
|
Chris@0
|
50 public function getLangcode(Request $request = NULL);
|
Chris@0
|
51
|
Chris@0
|
52 /**
|
Chris@0
|
53 * Notifies the plugin that the language code it returned has been accepted.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @param \Drupal\Core\Language\LanguageInterface $language
|
Chris@0
|
56 * The accepted language.
|
Chris@0
|
57 */
|
Chris@0
|
58 public function persist(LanguageInterface $language);
|
Chris@0
|
59
|
Chris@0
|
60 }
|