You are here

protected function PoolForm::getRemotePools in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 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 567

Class

PoolForm
Form handler for the Pool add and edit forms.

Namespace

Drupal\cms_content_sync\Form

Code

protected function getRemotePools(FormStateInterface $form_state) {

  /**
   * @var Pool $entity
   */
  $entity = $this->entity;
  $client = $entity
    ->getClient();
  $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;
}