0

I have two modules that rely on the same field; A simple boolean field that represents a state for taxonomy terms. My problem is my configuration management for this. My ideal situation would be to put this field storage configuration in my site's config directory and then both modules' info files specify a configuration dependency (using the field config's ID) on this field. But I cannot get it working.

This is what I have tried to far in both my module's info files:

dependencies:
  - taxonomy
  - config: 
    - taxonomy_term.field_my_field

and

config_dependencies:
  - taxonomy_term.field_my_field

For both of these methods, the field.storage.taxonomy_term.field_my_field.yml file is among the rest of the site's config. I can move it to either module's config/install directories and it makes no difference.

My field's storage config file is as so:

uuid: 8e23dc90-2da9-4824-9783-093181987869
langcode: en
status: true
dependencies:
  module:
    - taxonomy
_core:
  default_config_hash: pr_yX1hCVsd_ni59pjsAQh5n7hCJ2eAnPNzJCBCHJig
id: taxonomy_term.field_my_field
field_name: field_my_field
entity_type: taxonomy_term
type: boolean
settings: {  }
module: core
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

So my question is, what is generally the best practice for managing a single piece of configuration that's required by 2+ modules?

0

Updating Drush solved my problem... I went from 8.1.16 which I used deliberately due to it's compatibility with D7 & 8 as I'm still working with lots of 7 sites. After updating to 9.4.0, the field's storage config in the site's configuration directory gets imported no problem.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.