public function TawkToWidgetController::__construct in Tawk.to - Live chat application (Drupal 8) 8
Same name and namespace in other branches
- 8.2 src/Controller/TawkToWidgetController.php \Drupal\tawk_to\Controller\TawkToWidgetController::__construct()
Constructs a TawkToWidgetController object.
Parameters
\Symfony\Component\HttpFoundation\RequestStack $request: The request stack.
\Drupal\Core\Config\ConfigFactoryInterface $config: The configuration factory service.
File
- src/
Controller/ TawkToWidgetController.php, line 46
Class
- TawkToWidgetController
- Controller routine that manages tawk.to widget settings.
Namespace
Drupal\tawk_to\ControllerCode
public function __construct(RequestStack $request, ConfigFactoryInterface $config, LanguageManagerInterface $languageManager) {
$this->request = $request;
$this->languageManager = $languageManager;
$currentLanguage = $this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId();
$this->config = $config
->getEditable('tawk_to.settings');
// Allows saving of the widget settings form multiple languages.
if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) {
$configOverride = $this->languageManager
->getLanguageConfigOverride($currentLanguage, 'tawk_to.settings');
if (!$configOverride
->isNew()) {
$this->config = $configOverride;
}
}
}