This repository has been archived on 2025-09-29. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drupalcampbristol/web/core/modules/language/src/LanguageNegotiationMethodBase.php
2017-02-13 15:31:17 +00:00

63 lines
1.3 KiB
PHP

<?php
namespace Drupal\language;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Base class for language negotiation methods.
*/
abstract class LanguageNegotiationMethodBase implements LanguageNegotiationMethodInterface {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $config;
/**
* The current active user.
*
* @return \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* {@inheritdoc}
*/
public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager) {
$this->languageManager = $language_manager;
}
/**
* {@inheritdoc}
*/
public function setConfig(ConfigFactoryInterface $config) {
$this->config = $config;
}
/**
* {@inheritdoc}
*/
public function setCurrentUser(AccountInterface $current_user) {
$this->currentUser = $current_user;
}
/**
* {@inheritdoc}
*/
public function persist(LanguageInterface $language) {
// Default implementation persists nothing.
}
}