function FieldStorageDefinitionEventSubscriberTrait::onFieldStorageDefinitionEvent

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldStorageDefinitionEventSubscriberTrait.php \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait::onFieldStorageDefinitionEvent()
  2. 10 core/lib/Drupal/Core/Field/FieldStorageDefinitionEventSubscriberTrait.php \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait::onFieldStorageDefinitionEvent()
  3. 11.x core/lib/Drupal/Core/Field/FieldStorageDefinitionEventSubscriberTrait.php \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait::onFieldStorageDefinitionEvent()

Listener method for any field storage definition event.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionEvent $event: The field storage definition event object.

string $event_name: The event name.

File

core/lib/Drupal/Core/Field/FieldStorageDefinitionEventSubscriberTrait.php, line 40

Class

FieldStorageDefinitionEventSubscriberTrait
Helper methods for FieldStorageDefinitionListenerInterface.

Namespace

Drupal\Core\Field

Code

public function onFieldStorageDefinitionEvent(FieldStorageDefinitionEvent $event, $event_name) {
    switch ($event_name) {
        case FieldStorageDefinitionEvents::CREATE:
            $this->onFieldStorageDefinitionCreate($event->getFieldStorageDefinition());
            break;
        case FieldStorageDefinitionEvents::UPDATE:
            $this->onFieldStorageDefinitionUpdate($event->getFieldStorageDefinition(), $event->getOriginal());
            break;
        case FieldStorageDefinitionEvents::DELETE:
            $this->onFieldStorageDefinitionDelete($event->getFieldStorageDefinition());
            break;
    }
}

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