You are here

protected function EntityReferenceHandlerBase::getFieldValuesForReference in CMS Content Sync 8

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

Get the values to be set to the $entity->field_*.

Parameters

$reference:

$intent:

Return value

array

1 call to EntityReferenceHandlerBase::getFieldValuesForReference()
EntityReferenceHandlerBase::setValues in src/Plugin/EntityReferenceHandlerBase.php
3 methods override EntityReferenceHandlerBase::getFieldValuesForReference()
DefaultFieldCollectionHandler::getFieldValuesForReference in src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php
DefaultMenuLinkContentReferenceHandler::getFieldValuesForReference in src/Plugin/cms_content_sync/field_handler/DefaultMenuLinkContentReferenceHandler.php
Get the values to be set to the $entity->field_*.
DefaultWebformHandler::getFieldValuesForReference in src/Plugin/cms_content_sync/field_handler/DefaultWebformHandler.php
Get the values to be set to the $entity->field_*.

File

src/Plugin/EntityReferenceHandlerBase.php, line 440

Class

EntityReferenceHandlerBase
Providing a base implementation for any reference field type.

Namespace

Drupal\cms_content_sync\Plugin

Code

protected function getFieldValuesForReference($reference, $intent) {
  if ('entity_reference_revisions' == $this->fieldDefinition
    ->getType()) {
    $attributes = [
      'target_id' => $reference
        ->id(),
      'target_revision_id' => $reference
        ->getRevisionId(),
    ];
  }
  else {
    $attributes = [
      'target_id' => $reference
        ->id(),
    ];
  }
  return $attributes;
}