function DeletedFieldsRepository::addFieldDefinition

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

Overrides DeletedFieldsRepositoryInterface::addFieldDefinition

File

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

Class

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

Namespace

Drupal\Core\Field

Code

public function addFieldDefinition(FieldDefinitionInterface $field_definition) {
    $deleted_field_definitions = $this->state
        ->get('field.field.deleted', []);
    $deleted_field_definitions[$field_definition->getUniqueIdentifier()] = $field_definition;
    $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.