function DeletedFieldsRepository::removeFieldDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/DeletedFieldsRepository.php \Drupal\Core\Field\DeletedFieldsRepository::removeFieldDefinition()
  2. 8.9.x core/lib/Drupal/Core/Field/DeletedFieldsRepository.php \Drupal\Core\Field\DeletedFieldsRepository::removeFieldDefinition()
  3. 11.x core/lib/Drupal/Core/Field/DeletedFieldsRepository.php \Drupal\Core\Field\DeletedFieldsRepository::removeFieldDefinition()

File

core/lib/Drupal/Core/Field/DeletedFieldsRepository.php, line 78

Class

DeletedFieldsRepository
Provides a repository for deleted field and field storage objects.

Namespace

Drupal\Core\Field

Code

public function removeFieldDefinition(FieldDefinitionInterface $field_definition) {
    $deleted_field_definitions = $this->state
        ->get('field.field.deleted', []);
    unset($deleted_field_definitions[$field_definition->getUniqueIdentifier()]);
    $this->state
        ->set('field.field.deleted', $deleted_field_definitions);
    return $this;
}

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