You are here

protected function PoolForm::getRemotePools in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Form/PoolForm.php \Drupal\cms_content_sync\Form\PoolForm::getRemotePools()
  2. 2.0.x src/Form/PoolForm.php \Drupal\cms_content_sync\Form\PoolForm::getRemotePools()

List all remote pools that aren't used locally yet.

Throws

\Exception

1 call to PoolForm::getRemotePools()
PoolForm::poolForm in src/Form/PoolForm.php
Step 3: Select an existing pool or create a new one.

File

src/Form/PoolForm.php, line 559

Class

PoolForm
Form handler for the Pool add and edit forms.

Namespace

Drupal\cms_content_sync\Form

Code

protected function getRemotePools(FormStateInterface $form_state) {
  $client = SyncCoreFactory::getSyncCore($form_state
    ->getValue('backend_url'));
  $pools = $client
    ->getConfigurationService()
    ->listRemotePools();
  $local_pools = Pool::getAll();
  foreach ($pools as $id => $name) {

    // Already exists locally.
    if (isset($local_pools[$id])) {
      unset($pools[$id]);
    }
  }
  return $pools;
}