public function FlowControllerBase::getPoolsToPushTo in CMS Content Sync 2.1.x
Get a list of all pools that are used for pushing this entity, either automatically or manually selected.
Parameters
string|string[] $reason: {@see Flow::PUSH_*}
string $action: {@see ::ACTION_*}
bool $include_forced: Include forced pools. Otherwise only use-selected / referenced ones.
Return value
Pool[]
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- src/
Controller/ FlowControllerBase.php, line 140
Class
Namespace
Drupal\cms_content_sync\ControllerCode
public function getPoolsToPushTo(EntityInterface $entity, $reason, $action, $include_forced = true) {
$config = $this
->getEntityTypeConfig($entity
->getEntityTypeId(), $entity
->bundle());
if (!$this
->canPushEntity($entity, $reason, $action)) {
return [];
}
$result = [];
$pools = Pool::getAll();
foreach ($config['export_pools'] as $id => $setting) {
if (!isset($pools[$id])) {
continue;
}
$pool = $pools[$id];
if (Pool::POOL_USAGE_FORBID == $setting) {
continue;
}
if (Pool::POOL_USAGE_FORCE == $setting) {
if ($include_forced) {
$result[$id] = $pool;
}
continue;
}
$entity_status = EntityStatus::getInfoForEntity($entity
->getEntityTypeId(), $entity
->uuid(), $this->flow, $pool);
if ($entity_status && $entity_status
->isPushEnabled()) {
$result[$id] = $pool;
}
}
return $result;
}