You are here

protected function EntityHandlerBase::ignorePush in CMS Content Sync 2.0.x

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

Check if the entity should not be ignored from the push.

Parameters

\Drupal\cms_content_sync\SyncIntent $intent: The Sync Core Request

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity that could be ignored

string $reason: The reason why the entity should be ignored from the push

string $action: The action to apply

Return value

bool Whether or not to ignore this push request

Throws

\Exception

3 calls to EntityHandlerBase::ignorePush()
DefaultMenuLinkContentHandler::ignorePush in src/Plugin/cms_content_sync/entity_handler/DefaultMenuLinkContentHandler.php
Check if the entity should not be ignored from the push.
DefaultNodeHandler::ignorePush in src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php
Check if the entity should not be ignored from the push.
EntityHandlerBase::push in src/Plugin/EntityHandlerBase.php
2 methods override EntityHandlerBase::ignorePush()
DefaultMenuLinkContentHandler::ignorePush in src/Plugin/cms_content_sync/entity_handler/DefaultMenuLinkContentHandler.php
Check if the entity should not be ignored from the push.
DefaultNodeHandler::ignorePush in src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php
Check if the entity should not be ignored from the push.

File

src/Plugin/EntityHandlerBase.php, line 771

Class

EntityHandlerBase
Common base class for entity handler plugins.

Namespace

Drupal\cms_content_sync\Plugin

Code

protected function ignorePush(PushIntent $intent) {
  $reason = $intent
    ->getReason();
  $action = $intent
    ->getAction();
  if (PushIntent::PUSH_AUTOMATICALLY == $reason) {
    if (PushIntent::PUSH_MANUALLY == $this->settings['export']) {
      return true;
    }
  }
  if (SyncIntent::ACTION_UPDATE == $action) {
    foreach (EntityStatus::getInfosForEntity($intent
      ->getEntityType(), $intent
      ->getUuid()) as $info) {
      $flow = $info
        ->getFlow();
      if (!$flow) {
        continue;
      }
      if (!$info
        ->getLastPull()) {
        continue;
      }
      if (!$info
        ->isSourceEntity()) {
        break;
      }
      $config = $flow
        ->getEntityTypeConfig($intent
        ->getEntityType(), $intent
        ->getBundle());
      if (PullIntent::PULL_UPDATE_FORCE_UNLESS_OVERRIDDEN == $config['import_updates']) {
        return true;
      }
    }
  }
  return false;
}