protected function DefaultFieldCollectionHandler::getFieldValuesForReference in CMS Content Sync 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultFieldCollectionHandler::getFieldValuesForReference()
- 2.1.x src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultFieldCollectionHandler::getFieldValuesForReference()
Parameters
$reference:
\Drupal\cms_content_sync\PullIntent $intent:
Return value
array
Overrides EntityReferenceHandlerBase::getFieldValuesForReference
File
- src/
Plugin/ cms_content_sync/ field_handler/ DefaultFieldCollectionHandler.php, line 101
Class
- DefaultFieldCollectionHandler
- Providing a minimalistic implementation for any field type.
Namespace
Drupal\cms_content_sync\Plugin\cms_content_sync\field_handlerCode
protected function getFieldValuesForReference($reference, $intent) {
$entity = $intent
->getEntity();
$reference->host_type = $entity
->getEntityTypeId();
$reference->host_id = $entity
->id();
$reference->host_entity = $entity;
$reference->field_name = $this->fieldName;
$reference
->save(true);
return [
'value' => $reference
->id(),
'revision_id' => $reference
->getRevisionId(),
];
}