You are here

public static function PushIntent::getFlowsForEntity in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::getFlowsForEntity()
  2. 2.0.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::getFlowsForEntity()

Get the correct synchronization for a specific action on a given entity.

Parameters

string|string[] $reason:

string $action:

Return value

\Drupal\cms_content_sync\Entity\Flow[]

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

6 calls to PushIntent::getFlowsForEntity()
cms_content_sync_get_publish_changes_operations in ./cms_content_sync.module
Returns operations for "push changes" action.
cms_content_sync_show_usage_operation in ./cms_content_sync.module
Flow::getFlowsForPushing in src/Entity/Flow.php
Get all flows pushing this entity.
PushEntities::addEntity in src/Controller/PushEntities.php
PushIntent::pushEntity in src/PushIntent.php
Helper function to push an entity and throw errors if anything fails.

... See full list

File

src/PushIntent.php, line 216

Class

PushIntent
Class PushIntent.

Namespace

Drupal\cms_content_sync

Code

public static function getFlowsForEntity(EntityInterface $entity, $reason, $action = SyncIntent::ACTION_CREATE) {
  $flows = Flow::getAll();
  $result = [];
  foreach ($flows as $flow) {
    if ($flow
      ->canPushEntity($entity, $reason, $action)) {
      $result[] = $flow;
    }
  }
  return $result;
}