You are here

public function ContentSyncSettings::setDirectSyncCoreAccessEnabled 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::setDirectSyncCoreAccessEnabled()
  2. 2.0.x src/Controller/ContentSyncSettings.php \Drupal\cms_content_sync\Controller\ContentSyncSettings::setDirectSyncCoreAccessEnabled()

Set whether or not to allow direct Sync Core communication.

Parameters

bool $set:

Throws

\Exception

File

src/Controller/ContentSyncSettings.php, line 311

Class

ContentSyncSettings
Class ContentSyncSettings.

Namespace

Drupal\cms_content_sync\Controller

Code

public function setDirectSyncCoreAccessEnabled($set) {
  $checked = [];

  // We don't distinguish between multiple Sync Cores. If it's enabled for one, it's enabled for all.
  foreach (Pool::getAll() as $pool) {
    $url = $pool
      ->getSyncCoreUrl();
    if (in_array($url, $checked)) {
      continue;
    }
    $checked[] = $url;
    try {
      $pool
        ->getClient()
        ->isDirectUserAccessEnabled($set);
    } catch (NotFoundException $e) {

      // No config exported yet, so skip this.
      continue;
    }
  }
}