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

  1. Install the Search API module and configure a search server.
  2. Install Field Inheritance and (for sake of ease of testing) the Recurring Events module.
  3. Add a custom field to default eventseries bundle.
  4. Set up a field inheritance to inherit the custom field onto the default eventinstance bundle using the 'inherit' strategy.
  5. Create a search index for eventinstance entities.
  6. Add the inherited field to the index.
  7. 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').

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

muriqui created an issue. See original summary.

muriqui’s picture

Status: Active » Needs review

owenbush made their first commit to this issue’s fork.

  • owenbush committed e1747e1b on 2.0.x authored by muriqui
    Issue #3415147: Computed field definitions created by inheritance have...
owenbush’s picture

Status: Needs review » Fixed

Thanks for the patch, this has been merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.