Problem/Motivation

One use case for Config Actions might be: enable adding optional fields to content entity_view_display and entity_form_display items. For example:

  • In Module A I provide a field storage for field_example.
  • In Module B, which does not depend on Module A, in config/optional I have a field_example that's added to the content type mycontent.

When that field is installed, I want to apply an add config action to the entity_view_display and entity_form_display items for mycontent. Part of that change will be adding the field as a config dependency.

Currently, this will work fine if Module A is installed before Module B. Otherwise, however, the actions will be run when the field that's being added to the displays doesn't exist.

Proposed resolution

Before running an action that adds a config dependency, test that the dependency is met. (Possibly, do the same for module dependencies.)

Remaining tasks

User interface changes

API changes

Data model changes

Comments

nedjo created an issue. See original summary.

mpotter’s picture

There is already the Path Validation stuff where you can check for an existing value of a specific path in the config. Sounds like in this case you'd want to test a value in a *different* config item (to test if the optional config was installed).

I don't really want to build a full "condition system" so maybe something else can be leveraged here, such as core conditions/actions.

Config Actions already does what it is intended in this case, which is that it doesn't care of the config exists or not...if the config doesn't exist then the action doesn't do anything (nor does it error)

mpotter’s picture

Status: Active » Closed (won't fix)