function _views_field_get_entity_type_storage

Same name in other branches
  1. 9 core/modules/views/views.views.inc \_views_field_get_entity_type_storage()
  2. 8.9.x core/modules/views/views.views.inc \_views_field_get_entity_type_storage()
  3. 11.x core/modules/views/views.views.inc \_views_field_get_entity_type_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.

3 calls to _views_field_get_entity_type_storage()
views_field_default_views_data in core/modules/views/views.views.inc
Default views data implementation for a field.
views_views_data in core/modules/views/views.views.inc
Implements hook_views_data().
views_views_data_alter in core/modules/views/views.views.inc
Implements hook_views_data_alter().

File

core/modules/views/views.views.inc, line 242

Code

function _views_field_get_entity_type_storage(FieldStorageConfigInterface $field_storage) {
    $result = FALSE;
    $entity_type_manager = \Drupal::entityTypeManager();
    if ($entity_type_manager->hasDefinition($field_storage->getTargetEntityTypeId())) {
        $storage = $entity_type_manager->getStorage($field_storage->getTargetEntityTypeId());
        $result = $storage instanceof SqlContentEntityStorage ? $storage : FALSE;
    }
    return $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.