You are here

public static function ShrinkTheWebSettingsPageController::shrinktheweb_check_scheme_options in ShrinkTheWeb 8

Check scheme function

2 calls to ShrinkTheWebSettingsPageController::shrinktheweb_check_scheme_options()
ShrinkTheWebSettingsPageController::renderSettingsPage in src/Controller/ShrinkTheWebSettingsPageController.php
shrinktheweb_install in ./shrinktheweb.install
Implements hook_install

File

src/Controller/ShrinkTheWebSettingsPageController.php, line 39

Class

ShrinkTheWebSettingsPageController
Class ShrinkTheWebSettingsPageController.

Namespace

Drupal\shrinktheweb\Controller

Code

public static function shrinktheweb_check_scheme_options() {
  $config = \Drupal::service('config.factory')
    ->getEditable('shrinktheweb.settings');
  if (self::shrinktheweb_is_ssl()) {
    $config
      ->set('shrinktheweb_enable_https', 1);
    $config
      ->set('shrinktheweb_enable_https_set_automatically', 1);
  }
  else {
    if ($config
      ->get('shrinktheweb_enable_https_set_automatically') == 1) {
      $config
        ->set('shrinktheweb_enable_https', 0);
      $config
        ->set('shrinktheweb_enable_https_set_automatically', 0);
    }
  }
  $config
    ->save();
}