protected function DefaultFieldCollectionHandler::loadReferencedEntity in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultFieldCollectionHandler::loadReferencedEntity()
- 2.0.x src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultFieldCollectionHandler::loadReferencedEntity()
Load the entity that is either referenced or embedded by $definition.
Parameters
$definition:
Return value
\Drupal\Core\Entity\EntityInterface
Throws
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
\Drupal\cms_content_sync\Exception\SyncException
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Overrides EntityReferenceHandlerBase::loadReferencedEntity
File
- src/
Plugin/ cms_content_sync/ field_handler/ DefaultFieldCollectionHandler.php, line 60
Class
- DefaultFieldCollectionHandler
- Providing a minimalistic implementation for any field type.
Namespace
Drupal\cms_content_sync\Plugin\cms_content_sync\field_handlerCode
protected function loadReferencedEntity(PullIntent $intent, $definition) {
$previousFieldHandler = self::$currentFieldHandler;
$previousPullIntent = self::$currentPullIntent;
// Expose current field and intent (to reference host entity)
// As field collections require this when being created.
self::$currentFieldHandler = $this;
self::$currentPullIntent = $intent;
$entity = parent::loadReferencedEntity($intent, $definition);
self::$currentFieldHandler = $previousFieldHandler;
self::$currentPullIntent = $previousPullIntent;
return $entity;
}