You are here

public function DeletedFieldsRepository::removeFieldDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/DeletedFieldsRepository.php \Drupal\Core\Field\DeletedFieldsRepository::removeFieldDefinition()

Removes a field definition object from the deleted list.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: A field definition object.

Return value

$this

Overrides DeletedFieldsRepositoryInterface::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;
}