You are here

public static function FieldStorageSubscriber::getSubscribedEvents in Dynamic Entity Reference 8.2

File

src/EventSubscriber/FieldStorageSubscriber.php, line 73

Class

FieldStorageSubscriber
Hands off field storage events to the integer column handler.

Namespace

Drupal\dynamic_entity_reference\EventSubscriber

Code

public static function getSubscribedEvents() {

  // When enabling a module implementing an entity type,
  // EntityTypeEvents::CREATE fires and FieldStorageDefinitionEvents::CREATE
  // does not. On the other hand, when adding a field
  // to an existing entity type, EntityTypeEvents::UPDATE does not fire but
  // FieldStorageDefinitionEvents::CREATE does. This is true for saving a
  // FieldStorageConfig object or enabling a module implementing
  // hook_entity_base_field_info().
  $events[FieldStorageDefinitionEvents::CREATE][] = [
    'onFieldStorage',
    100,
  ];
  $events[EntityTypeEvents::CREATE][] = [
    'onEntityType',
    100,
  ];
  return $events;
}