You are here

public function DefaultMenuLinkContentHandler::ignorePull in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Plugin/cms_content_sync/entity_handler/DefaultMenuLinkContentHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultMenuLinkContentHandler::ignorePull()
  2. 2.0.x src/Plugin/cms_content_sync/entity_handler/DefaultMenuLinkContentHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultMenuLinkContentHandler::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/DefaultMenuLinkContentHandler.php, line 112

Class

DefaultMenuLinkContentHandler
Class DefaultMenuLinkContentHandler, providing a minimalistic implementation for menu items, making sure they're referenced correctly by UUID.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler

Code

public function ignorePull(PullIntent $intent) {
  $action = $intent
    ->getAction();
  if (SyncIntent::ACTION_DELETE == $action) {
    return parent::ignorePull($intent);
  }
  if (empty($this->resolveDependent)) {
    if (empty($intent
      ->getProperty('enabled'))) {
      $enabled = true;
    }
    else {
      $enabled = $intent
        ->getProperty('enabled')[0]['value'];
    }
  }
  else {
    $enabled = $this->resolveDependent['data']['enabled'];
  }

  // Not published? Ignore this revision then.
  if (!$enabled && $this->settings['handler_settings']['ignore_unpublished']) {

    // Unless it's a delete, then it won't have a status and is independent.
    return true;
  }
  if ($this
    ->shouldRestrictMenuUsage()) {
    $menu = $intent
      ->getProperty('menu_name')[0]['value'];
    if (empty($this->settings['handler_settings']['restrict_menus'][$menu])) {
      return true;
    }
  }
  return parent::ignorePull($intent);
}