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. 10 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()
ViewsViewsHooks::viewsData in core/modules/views/src/Hook/ViewsViewsHooks.php
Implements hook_views_data().
ViewsViewsHooks::viewsDataAlter in core/modules/views/src/Hook/ViewsViewsHooks.php
Implements hook_views_data_alter().
views_field_default_views_data in core/modules/views/views.views.inc
Default views data implementation for a field.

File

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

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.