FieldStorageDefinitionEventSubscriberTrait.php in Drupal 10
File
core/lib/Drupal/Core/Field/FieldStorageDefinitionEventSubscriberTrait.php
View source
<?php
namespace Drupal\Core\Field;
trait FieldStorageDefinitionEventSubscriberTrait {
public static function getFieldStorageDefinitionEvents() {
$event = [
'onFieldStorageDefinitionEvent',
100,
];
$events[FieldStorageDefinitionEvents::CREATE][] = $event;
$events[FieldStorageDefinitionEvents::UPDATE][] = $event;
$events[FieldStorageDefinitionEvents::DELETE][] = $event;
return $events;
}
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;
}
}
public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) {
}
public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
}
public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {
}
}