You are here

public function PushIntent::__construct in CMS Content Sync 8

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

PushIntent constructor.

Parameters

$reason:

$action:

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Exception

Overrides SyncIntent::__construct

File

src/PushIntent.php, line 173

Class

PushIntent
Class PushIntent.

Namespace

Drupal\cms_content_sync

Code

public function __construct(Flow $flow, Pool $pool, $reason, $action, EntityInterface $entity) {
  parent::__construct($flow, $pool, $reason, $action, $entity
    ->getEntityTypeId(), $entity
    ->bundle(), $entity
    ->uuid(), $entity instanceof ConfigEntityInterface ? $entity
    ->id() : null);
  if (!$this->entity_status
    ->getLastPush()) {
    if (!EntityStatus::getLastPullForEntity($entity) && !PullIntent::entityHasBeenPulledFromRemoteSite($entity
      ->getEntityTypeId(), $entity
      ->uuid())) {
      $this->entity_status
        ->isSourceEntity(true);
    }
  }
  $this->entity = $entity;
  $moduleHandler = \Drupal::service('module_handler');
  $quickedit_enabled = $moduleHandler
    ->moduleExists('quickedit');
  if ($quickedit_enabled && !empty(\Drupal::service('tempstore.private')
    ->get('quickedit')
    ->get($entity
    ->uuid()))) {
    $this->isQuickEdited = true;
  }
  $this->operation = $this->pool
    ->getClient()
    ->getSyndicationService()
    ->pushSingle($this->flow->id, $entity
    ->getEntityTypeId(), $entity
    ->bundle(), $entity
    ->uuid(), EntityHandlerPluginManager::isEntityTypeConfiguration($entity
    ->getEntityType()) ? $entity
    ->id() : null)
    ->toPool($this->pool->id)
    ->asDependency(PushIntent::PUSH_AS_DEPENDENCY == $this->flow
    ->getEntityTypeConfig($entity
    ->getEntityTypeId(), $entity
    ->bundle())['export']);
}