function DeletedFieldsRepository::getFieldDefinitions

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

Overrides DeletedFieldsRepositoryInterface::getFieldDefinitions

File

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

Class

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

Namespace

Drupal\Core\Field

Code

public function getFieldDefinitions($field_storage_unique_id = NULL) {
    $deleted_field_definitions = $this->state
        ->get('field.field.deleted', []);
    if ($field_storage_unique_id) {
        $deleted_field_definitions = array_filter($deleted_field_definitions, function (FieldDefinitionInterface $field_definition) use ($field_storage_unique_id) {
            return $field_definition->getFieldStorageDefinition()
                ->getUniqueStorageIdentifier() === $field_storage_unique_id;
        });
    }
    return $deleted_field_definitions;
}

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