public function FlowControllerBase::canPullEntity in CMS Content Sync 2.1.x
Ask this Flow whether or not it can push the provided entity.
Parameters
string $entity_type_name:
string $bundle_name:
string $reason:
string $action:
bool $strict: If asking for DEPENDENCY as a $reason, then $strict will NOT include a Flow that pulls AUTOMATICALLY
Return value
bool
File
- src/
Controller/ FlowControllerBase.php, line 275
Class
Namespace
Drupal\cms_content_sync\ControllerCode
public function canPullEntity($entity_type_name, $bundle_name, $reason, $action = SyncIntent::ACTION_CREATE, $strict = false) {
$config = $this
->getEntityTypeConfig($entity_type_name, $bundle_name);
if (empty($config) || Flow::HANDLER_IGNORE == $config['handler']) {
return false;
}
if (PullIntent::PULL_DISABLED == $config['import']) {
return false;
}
if (SyncIntent::ACTION_DELETE == $action && !boolval($config['import_deletion_settings']['import_deletion'])) {
return false;
}
// If any handler is available, we can pull this entity.
if (PullIntent::PULL_FORCED == $reason) {
return true;
}
// Flows that pull automatically can also handle referenced entities.
if (PullIntent::PULL_AUTOMATICALLY == $config['import']) {
if (PullIntent::PULL_AS_DEPENDENCY == $reason && !$strict) {
return true;
}
}
// Once pulled manually, updates will arrive automatically.
if (PullIntent::PULL_AUTOMATICALLY == $reason && PullIntent::PULL_MANUALLY == $config['import']) {
if (SyncIntent::ACTION_UPDATE == $action || SyncIntent::ACTION_DELETE == $action) {
return true;
}
}
return $config['import'] == $reason;
}