public static function Flow::getFlowsForPushing in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::getFlowsForPushing()
- 2.0.x src/Entity/Flow.php \Drupal\cms_content_sync\Entity\Flow::getFlowsForPushing()
Get all flows pushing this entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity:
$action:
bool $include_dependencies:
Return value
array|Flow[]
Throws
\Exception
1 call to Flow::getFlowsForPushing()
- cms_content_sync_form_alter in ./
cms_content_sync.module - 1) Make sure the user is informed that content will not only be deleted on this * instance but also on all connected instances if configured that way.
File
- src/
Entity/ Flow.php, line 176
Class
- Flow
- Defines the "Content Sync - Flow" entity.
Namespace
Drupal\cms_content_sync\EntityCode
public static function getFlowsForPushing($entity, $action, $include_dependencies = true) {
if (SyncIntent::ACTION_DELETE === $action) {
$last_push = EntityStatus::getLastPushForEntity($entity);
if (empty($last_push)) {
return [];
}
}
$flows = PushIntent::getFlowsForEntity($entity, PushIntent::PUSH_AUTOMATICALLY, $action);
if (!count($flows) && SyncIntent::ACTION_DELETE === $action) {
$flows = PushIntent::getFlowsForEntity($entity, PushIntent::PUSH_MANUALLY, $action);
}
if ($include_dependencies && !count($flows)) {
$flows = PushIntent::getFlowsForEntity($entity, PushIntent::PUSH_AS_DEPENDENCY, $action);
if (count($flows)) {
$infos = EntityStatus::getInfosForEntity($entity
->getEntityTypeId(), $entity
->uuid());
$pushed = [];
foreach ($infos as $info) {
if (!in_array($info
->getFlow(), $flows)) {
continue;
}
if (in_array($info
->getFlow(), $pushed)) {
continue;
}
if (!$info
->getLastPush()) {
continue;
}
$pushed[] = $info
->getFlow();
}
$flows = $pushed;
}
}
return $flows;
}