You are here

public function DefaultNodeHandler::push in CMS Content Sync 2.0.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::push()
  2. 2.1.x src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultNodeHandler::push()

Parameters

\Drupal\cms_content_sync\PushIntent $intent: The request to store all relevant info at

Return value

bool Whether or not the content has been pushed. FALSE is a desired state, meaning nothing should be pushed according to config.

Throws

\Drupal\cms_content_sync\Exception\SyncException

Overrides EntityHandlerBase::push

File

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

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 push(PushIntent $intent, EntityInterface $entity = null) {
  if (!parent::push($intent, $entity)) {
    return false;
  }
  if (!$entity) {
    $entity = $intent
      ->getEntity();
  }

  /**
   * @var \Drupal\node\NodeInterface $entity
   */
  $this
    ->setDateProperty($intent, 'created', intval($entity
    ->getCreatedTime()));
  return true;
}