You are here

public function FieldTestItem::delete in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php \Drupal\entity_test\Plugin\Field\FieldType\FieldTestItem::delete()
  2. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php \Drupal\entity_test\Plugin\Field\FieldType\FieldTestItem::delete()

Defines custom delete behavior for field values.

This method is called during the process of deleting an entity, just before values are deleted from storage.

Overrides FieldItemBase::delete

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php, line 115

Class

FieldTestItem
Defines the 'field_test' entity field type.

Namespace

Drupal\entity_test\Plugin\Field\FieldType

Code

public function delete() {
  parent::delete();
  $deleted_languages = \Drupal::state()
    ->get('entity_test.delete.' . $this
    ->getFieldDefinition()
    ->getName(), []);
  $deleted_languages[] = $this
    ->getLangcode();
  \Drupal::state()
    ->set('entity_test.delete.' . $this
    ->getFieldDefinition()
    ->getName(), $deleted_languages);
}