You are here

public function Flow::usesPool in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::usesPool()

Check if the given pool is used by this Flow. If any handler set the flow as FORCE or ALLOW, this will return TRUE.

Parameters

Pool $pool:

Return value

bool

1 call to Flow::usesPool()
Flow::getUsedPools in src/Entity/Flow.php
Get a list of all pools this Flow is using.

File

src/Entity/Flow.php, line 703

Class

Flow
Defines the "Content Sync - Flow" entity.

Namespace

Drupal\cms_content_sync\Entity

Code

public function usesPool($pool) {
  foreach ($this
    ->getEntityTypeConfig(null, null, true) as $config) {
    if (Flow::HANDLER_IGNORE == $config['handler']) {
      continue;
    }
    if (PushIntent::PUSH_DISABLED != $config['export']) {
      if (!empty($config['export_pools'][$pool->id]) && Pool::POOL_USAGE_FORBID != $config['export_pools'][$pool->id]) {
        return true;
      }
    }
    if (PullIntent::PULL_DISABLED != $config['import']) {
      if (!empty($config['import_pools'][$pool->id]) && Pool::POOL_USAGE_FORBID != $config['import_pools'][$pool->id]) {
        return true;
      }
    }
  }
  return false;
}