Mercurial > hg > isophonics-drupal-site
annotate core/modules/language/src/LanguageNegotiationMethodBase.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 7a779792577d |
children |
rev | line source |
---|---|
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 |
Chris@0 | 9 /** |
Chris@0 | 10 * Base class for language negotiation methods. |
Chris@0 | 11 */ |
Chris@0 | 12 abstract class LanguageNegotiationMethodBase implements LanguageNegotiationMethodInterface { |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * The language manager. |
Chris@0 | 16 * |
Chris@0 | 17 * @var \Drupal\Core\Language\LanguageManagerInterface |
Chris@0 | 18 */ |
Chris@0 | 19 protected $languageManager; |
Chris@0 | 20 |
Chris@0 | 21 /** |
Chris@0 | 22 * The configuration factory. |
Chris@0 | 23 * |
Chris@0 | 24 * @var \Drupal\Core\Config\ConfigFactoryInterface |
Chris@0 | 25 */ |
Chris@0 | 26 protected $config; |
Chris@0 | 27 |
Chris@0 | 28 /** |
Chris@0 | 29 * The current active user. |
Chris@0 | 30 * |
Chris@12 | 31 * @var \Drupal\Core\Session\AccountInterface |
Chris@0 | 32 */ |
Chris@0 | 33 protected $currentUser; |
Chris@0 | 34 |
Chris@0 | 35 /** |
Chris@0 | 36 * {@inheritdoc} |
Chris@0 | 37 */ |
Chris@0 | 38 public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager) { |
Chris@0 | 39 $this->languageManager = $language_manager; |
Chris@0 | 40 } |
Chris@0 | 41 |
Chris@0 | 42 /** |
Chris@0 | 43 * {@inheritdoc} |
Chris@0 | 44 */ |
Chris@0 | 45 public function setConfig(ConfigFactoryInterface $config) { |
Chris@0 | 46 $this->config = $config; |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 /** |
Chris@0 | 50 * {@inheritdoc} |
Chris@0 | 51 */ |
Chris@0 | 52 public function setCurrentUser(AccountInterface $current_user) { |
Chris@0 | 53 $this->currentUser = $current_user; |
Chris@0 | 54 } |
Chris@0 | 55 |
Chris@0 | 56 /** |
Chris@0 | 57 * {@inheritdoc} |
Chris@0 | 58 */ |
Chris@0 | 59 public function persist(LanguageInterface $language) { |
Chris@0 | 60 // Default implementation persists nothing. |
Chris@0 | 61 } |
Chris@0 | 62 |
Chris@0 | 63 } |