public function Flow::canPushEntityType in CMS Content Sync 8
Same name and namespace in other branches
- 2.0.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::canPushEntityType()
Ask this Flow whether or not it can push the given entity type and optionally bundle.
Parameters
string $entity_type_name:
null|string $bundle_name:
string|string[] $reason:
string $action:
null|Pool $pool:
Return value
bool
1 call to Flow::canPushEntityType()
- Flow::canPushEntity in src/
Entity/ Flow.php - Ask this Flow whether or not it can push the given entity.
File
- src/
Entity/ Flow.php, line 455
Class
- Flow
- Defines the "Content Sync - Flow" entity.
Namespace
Drupal\cms_content_sync\EntityCode
public function canPushEntityType($entity_type_name, $bundle_name, $reason, $action = SyncIntent::ACTION_CREATE, $pool = null) {
$any_reason = [
PushIntent::PUSH_AUTOMATICALLY,
PushIntent::PUSH_MANUALLY,
PushIntent::PUSH_AS_DEPENDENCY,
];
if (is_string($reason)) {
if (PushIntent::PUSH_ANY === $reason || PushIntent::PUSH_FORCED === $reason) {
$reason = $any_reason;
}
else {
$reason = [
$reason,
];
}
}
if (!$bundle_name) {
foreach ($this
->getEntityTypeConfig($entity_type_name) as $config) {
if ($this
->canPushEntityType($entity_type_name, $config['bundle_name'], $reason, $action, $pool)) {
return true;
}
}
return false;
}
$config = $this
->getEntityTypeConfig($entity_type_name, $bundle_name);
if (empty($config) || self::HANDLER_IGNORE == $config['handler']) {
return false;
}
if (PushIntent::PUSH_DISABLED == $config['export']) {
return false;
}
if (SyncIntent::ACTION_DELETE == $action && !boolval($config['export_deletion_settings']['export_deletion'])) {
return false;
}
if ($pool) {
if (empty($config['export_pools'][$pool->id]) || Pool::POOL_USAGE_FORBID == $config['export_pools'][$pool->id]) {
return false;
}
}
return in_array($config['export'], $reason);
}