You are here

public static function PushIntent::isPushing in CMS Content Sync 2.0.x

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

Check whether the given entity is currently being pushed. Useful to check against hierarchical references as for nodes and menu items for example.

Parameters

string $entity_type: The entity type to check for

string $uuid: The UUID of the entity in question

string $pool: The pool to push to

null|string $action: See ::ACTION_*

Return value

bool

1 call to PushIntent::isPushing()
PushIntent::pushReference in src/PushIntent.php

File

src/PushIntent.php, line 546

Class

PushIntent
Class PushIntent.

Namespace

Drupal\cms_content_sync

Code

public static function isPushing($entity_type, $uuid, $pool = null, $action = null) {
  foreach (self::$pushed as $do => $types) {
    if ($action ? $do != $action : SyncIntent::ACTION_DELETE == $do) {
      continue;
    }
    if (!isset($types[$entity_type])) {
      continue;
    }
    foreach ($types[$entity_type] as $bundle => $entities) {
      if (empty($pool)) {
        if (!empty($entities[$uuid])) {
          return true;
        }
      }
      else {
        if (!empty($entities[$uuid][$pool])) {
          return true;
        }
      }
    }
  }
  return false;
}