You are here

public function ContentSyncSettings::getAuthenticationType in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Controller/ContentSyncSettings.php \Drupal\cms_content_sync\Controller\ContentSyncSettings::getAuthenticationType()
  2. 2.0.x src/Controller/ContentSyncSettings.php \Drupal\cms_content_sync\Controller\ContentSyncSettings::getAuthenticationType()

Return value

string

File

src/Controller/ContentSyncSettings.php, line 165

Class

ContentSyncSettings
Class ContentSyncSettings.

Namespace

Drupal\cms_content_sync\Controller

Code

public function getAuthenticationType() {
  if (null !== $this->authenticationType) {
    return $this->authenticationType;
  }
  $this->authenticationType = $this->configFactory
    ->get('cms_content_sync.settings')
    ->get('cms_content_sync_authentication_type');
  if (!$this->authenticationType) {
    if (\Drupal::service('module_handler')
      ->moduleExists('basic_auth')) {
      $this->authenticationType = IApplicationInterface::AUTHENTICATION_TYPE_BASIC_AUTH;
    }
    else {
      $this->authenticationType = IApplicationInterface::AUTHENTICATION_TYPE_COOKIE;
    }
  }
  return $this->authenticationType;
}