public function PagePolicy::__construct in General Data Protection Regulation Compliance 8
PagePolicy constructor.
Parameters
\Drupal\Core\Language\LanguageManagerInterface $languageManager: Language manager service.
\Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler: Module handler service.
\Symfony\Component\HttpFoundation\RequestStack $requestStack: Request stack service.
\Drupal\Core\Config\ConfigFactory $configFactory: Config factory service.
\Drupal\Core\Datetime\DateFormatterInterface $dateFormatter: Date format service.
File
- src/
Controller/ PagePolicy.php, line 52
Class
- PagePolicy
- Controller routines for page routes.
Namespace
Drupal\gdpr_compliance\ControllerCode
public function __construct(LanguageManagerInterface $languageManager, ModuleHandlerInterface $moduleHandler, RequestStack $requestStack, ConfigFactory $configFactory, DateFormatterInterface $dateFormatter) {
$this->moduleHandler = $moduleHandler;
$this->requestStack = $requestStack;
$this->configFactory = $configFactory;
$this->dataFormatter = $dateFormatter;
$current_language = $languageManager
->getCurrentLanguage()
->getId();
$langs = [
'en',
'ru',
'de',
];
if (in_array($current_language, $langs)) {
$this->lang = $current_language;
}
}