The field definition methods provided by the Entity Manager have gradually replaced the FieldInfo service that provided field information for configurable fields only.
The changes in #2116363: Unified repository of field definitions (cache + API) completed that conversion and provided the final pieces to deprecate and remove the FieldInfo service.
API changes
FieldInfo::getFieldMap()->EntityManager::getFieldMap()field_info_field($entity_type, $field_name)->FieldStorageConfig::loadByName($entity_type, $field_name)Only for cases where the code is explicitly working with configurable fields, seenode_add_body_field()as an example.field_info_instance($entity_type, $field_name, $bundle)->FieldConfig::loadByName($entity_type, $bundle, $field_name).
Only for cases where the code is explicitly working with configurable fields, seenode_add_body_field()as an example. Note the different order of arguments.
When working directly with an $entity, the field definitions (which include base and configurable fields) can be directly requested from the object with $entity->getFieldDefinitions() or $entity->getFieldDefinition($field_name). In case an entity object is not available, the EntityManager provides the methods getFieldDefinitions($entity_type, $bundle) getFieldStorageDefinitions($entity_type). See the related change records for more information on those changes.
Comments
field_info_instances() and field_info_fields() ?
I can't see how to do the equivalent of field_info_instances() and field_info_fields() ?
getFieldStorageDefinitions($entity_type_id) works for content entity types but how do I get the content entity types?
Could it be that the FieldInfo conversion is not actually complete?
What do you want to do?
What do you want to do?
fields and instances are always by entity_type now, so you need them anyway. If you want a list of all fields/instances, you can use the field map, and if you just want configurable fields, you can just load field/instance config entities.
FYI , this is how to load the
FYI , this is how to load the "field map"
load field config in Drupal 8
For load filed:
To get more settings like list of allowed values for drop-down: