_views_field_get_entity_type_storage

_views_field_get_entity_type_storage(FieldStorageConfigInterface $field_storage)

Determines whether the entity type the field appears in is SQL based.

Parameters

\Drupal\field\FieldStorageConfigInterface $field_storage: The field storage definition.

Return value

\Drupal\Core\Entity\Sql\SqlContentEntityStorage Returns the entity type storage if supported.

File

core/modules/views/views.views.inc, line 232
Provide views data that isn't tied to any other module.

Code

function _views_field_get_entity_type_storage(FieldStorageConfigInterface $field_storage) {
  $result = FALSE;
  $entity_manager = \Drupal::entityManager();
  if ($entity_manager->hasDefinition($field_storage->getTargetEntityTypeId())) {
    $storage = $entity_manager->getStorage($field_storage->getTargetEntityTypeId());
    $result = $storage instanceof SqlContentEntityStorage ? $storage : FALSE;
  }
  return $result;
}
doc_Drupal
2016-10-29 09:57:23
Comments
Leave a Comment

Please login to continue.