FieldDefinitionListenerInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Drupal\Core\Field;
  3. /**
  4. * Defines an interface for reacting to field creation, deletion, and updates.
  5. */
  6. interface FieldDefinitionListenerInterface {
  7. /**
  8. * Reacts to the creation of a field.
  9. *
  10. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
  11. * The field definition created.
  12. */
  13. public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition);
  14. /**
  15. * Reacts to the update of a field.
  16. *
  17. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
  18. * The field definition being updated.
  19. * @param \Drupal\Core\Field\FieldDefinitionInterface $original
  20. * The original field definition; i.e., the definition before the update.
  21. */
  22. public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original);
  23. /**
  24. * Reacts to the deletion of a field.
  25. *
  26. * Stored values should not be wiped at once, but marked as 'deleted' so that
  27. * they can go through a proper purge process later on.
  28. *
  29. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
  30. * The field definition being deleted.
  31. */
  32. public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition);
  33. }