You are here

public function DefaultNodeHandler::setEntityValues 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::setEntityValues()
  2. 2.1.x src/Plugin/cms_content_sync/entity_handler/DefaultNodeHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultNodeHandler::setEntityValues()

Set the values for the pulled entity.

Parameters

\Drupal\cms_content_sync\SyncIntent $intent:

\Drupal\Core\Entity\FieldableEntityInterface $entity: The translation of the entity

Return value

bool Returns TRUE when the values are set

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\cms_content_sync\Exception\SyncException

Overrides EntityHandlerBase::setEntityValues

See also

Flow::PULL_*

File

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

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 setEntityValues(PullIntent $intent, FieldableEntityInterface $entity = null) {
  if (!$entity) {
    $entity = $intent
      ->getEntity();
  }
  $entity
    ->setRevisionCreationTime(time());
  if ($intent
    ->getProperty('revision_log')) {
    $entity
      ->setRevisionLogMessage(reset($intent
      ->getProperty('revision_log')[0]));
  }
  return parent::setEntityValues($intent, $entity);
}