You are here

public static function EntityStatus::getLastPushForEntity in CMS Content Sync 2.0.x

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

Return value

null|int

Throws

\Exception

3 calls to EntityStatus::getLastPushForEntity()
Flow::getFlowsForPushing in src/Entity/Flow.php
Get all flows pushing this entity.
_cms_content_sync_add_usage_form in ./cms_content_sync.module
Add a button "Show usage" to show all sites using this content.
_cms_content_sync_paragraphs_push_settings_form in ./cms_content_sync.module
Add the Push settings for to the several Paragraph widget types.

File

src/Entity/EntityStatus.php, line 262

Class

EntityStatus
Defines the "Content Sync - Entity Status" entity type.

Namespace

Drupal\cms_content_sync\Entity

Code

public static function getLastPushForEntity(EntityInterface $entity) {
  $entity_status = EntityStatus::getInfosForEntity($entity
    ->getEntityTypeId(), $entity
    ->uuid());
  $latest = null;
  foreach ($entity_status as $info) {
    if ($info
      ->getLastPush() && (!$latest || $info
      ->getLastPush() > $latest)) {
      $latest = $info
        ->getLastPush();
    }
  }
  return $latest;
}