You are here

protected function DefaultFieldCollectionHandler::loadReferencedEntityFromFieldValue in CMS Content Sync 8

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

Load the referenced entity, given the $entity->field_* value.

Parameters

$value:

Return value

null|\Drupal\Core\Entity\EntityInterface

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides EntityReferenceHandlerBase::loadReferencedEntityFromFieldValue

File

src/Plugin/cms_content_sync/field_handler/DefaultFieldCollectionHandler.php, line 81

Class

DefaultFieldCollectionHandler
Providing a minimalistic implementation for any field type.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler

Code

protected function loadReferencedEntityFromFieldValue($value) {
  if (empty($value['revision_id'])) {
    return null;
  }
  return \Drupal::entityTypeManager()
    ->getStorage('field_collection_item')
    ->loadRevision($value['revision_id']);
}