2 * Implements hook_entity_field_storage_info().
4 function {{ machine_name }}_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
5 if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
6 // Query by filtering on the ID as this is more efficient than filtering
7 // on the entity_type property directly.
8 $ids = \Drupal::entityQuery('field_storage_config')
9 ->condition('id', $entity_type->id() . '.', 'STARTS_WITH')
11 // Fetch all fields and key them by field name.
12 $field_storages = FieldStorageConfig::loadMultiple($ids);
14 foreach ($field_storages as $field_storage) {
15 $result[$field_storage->getName()] = $field_storage;