public function FlowControllerBase::canPushEntity in CMS Content Sync 2.1.x
@inheritDoc
1 call to FlowControllerBase::canPushEntity()
- FlowControllerBase::getPoolsToPushTo in src/
Controller/ FlowControllerBase.php - Get a list of all pools that are used for pushing this entity, either automatically or manually selected.
File
- src/
Controller/ FlowControllerBase.php, line 99
Class
Namespace
Drupal\cms_content_sync\ControllerCode
public function canPushEntity(EntityInterface $entity, $reason, $action = SyncIntent::ACTION_CREATE, $pool = null) {
$infos = $entity
->uuid() ? EntityStatus::getInfosForEntity($entity
->getEntityTypeId(), $entity
->uuid()) : [];
// Fresh entity- no pool restriction.
if (!count($infos) || null !== $pool) {
return $this
->canPushEntityType($entity
->getEntityTypeId(), $entity
->bundle(), $reason, $action, $pool);
}
// If the entity has been pulled or pushed before, only the Flows that support the pools that were assigned
// are relevant. So we filter out any Flows here that don't support any of the assigned pools.
foreach ($infos as $info) {
if ($this
->canPushEntityType($entity
->getEntityTypeId(), $entity
->bundle(), $reason, $action, $info
->getPool())) {
return true;
}
}
// Flow config may have changed so status entities exist but now they no longer push the entity. In this case we
// fall back into the behavior as if the entity was new (see above)
return $this
->canPushEntityType($entity
->getEntityTypeId(), $entity
->bundle(), $reason, $action, $pool);
}