function _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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!views!views.views.inc/function/_views_field_get_entity_type_storage/8.1.x