You are here

public function DefaultNodeHandler::ignorePull in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultNodeHandler::ignorePull()
  2. 2.0.x src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultNodeHandler::ignorePull()

Check if the pull should be ignored.

Return value

bool Whether or not to ignore this pull request

Overrides EntityHandlerBase::ignorePull

File

src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php, line 123

Class

DefaultNodeHandler
Class DefaultNodeHandler, providing proper handling for published/unpublished content.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler

Code

public function ignorePull(PullIntent $intent) {

  // Not published? Ignore this revision then.
  if (empty($intent
    ->getProperty('status')[0]['value']) && $this->settings['handler_settings']['ignore_unpublished']) {
    if (!$this->settings['handler_settings']['allow_explicit_unpublishing'] || SyncIntent::ACTION_CREATE === $intent
      ->getAction()) {

      // Unless it's a delete, then it won't have a status and is independent
      // of published state, so we don't ignore the pull.
      if (SyncIntent::ACTION_DELETE != $intent
        ->getAction()) {
        return true;
      }
    }
  }
  return parent::ignorePull($intent);
}