You are here

function language_cookie_install in Language Cookie 8

Same name and namespace in other branches
  1. 7.2 language_cookie.install \language_cookie_install()

Implements hook_install().

File

./language_cookie.install, line 16
The install and update code for the language_cookie module.

Code

function language_cookie_install() {

  // Set up preferred language negotiation type to fetch the language from
  // (the interface language, in our case).
  $config = \Drupal::configFactory()
    ->getEditable('language_cookie.negotiation');
  $config
    ->set('language_type', LanguageInterface::TYPE_INTERFACE);
  if (\Drupal::request()
    ->isSecure()) {
    $config
      ->set('secure', TRUE);
  }
  $config
    ->save();
}