Problem/Motivation
The computed field definitions created by field_inheritance_entity_bundle_field_info_alter() do not set a provider (module). If these fields are then used in a Search API index, it causes the search index config to be exported with a dependency on a null module, which in turn causes the following error when the config is imported:
Configuration search_api.index.my_index depends on the "" module that will not be installed after import.
Steps to reproduce
- Install the Search API module and configure a search server.
- Install Field Inheritance and (for sake of ease of testing) the Recurring Events module.
- Add a custom field to default eventseries bundle.
- Set up a field inheritance to inherit the custom field onto the default eventinstance bundle using the 'inherit' strategy.
- Create a search index for eventinstance entities.
- Add the inherited field to the index.
- Export the config.
Expected results: The exported search_api.index.my_index.yml should contain values similar to the following:
dependencies:
config:
- search_api.server.elasticsearch
module:
- recurring_events
- field_inheritance
- search_api
and
field_settings:
my_inherited_field:
...
dependencies:
module:
- field_inheritance
Actual results: The config declares dependencies on a null module, like so:
dependencies:
config:
- search_api.server.elasticsearch
module:
- recurring_events
- ''
- search_api
and
field_settings:
my_inherited_field:
...
dependencies:
module:
- null
Proposed resolution
On the $fields[$field->idWithoutTypeAndBundle()] = FieldStorageDefinition::create($type)
statement chain, call ->setProvider('field_inheritance')
.