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