0

I have a custom module with the file config/install/core.entity_view_display.node.event.featured.yml which contains config for a display mode called 'featured' for the content type 'event'.

The problem is, Drupal won't import these settings because the view mode 'featured' already exists.

I'm aware it already exists. I don't want to create the view mode. I want to simply import the settings for that view mode. I.e. populate the settings for each of the fields in that display mode.

Is there a way to do this without deleting the view mode before installing my module?

0

Features may help you solve this problem - https://www.drupal.org/project/features . If you have Features enabled, and the module include a mymodule.features.yml file in it, it can gracefully handle updating existing configuration like this without throwing the nasty error. You can do a drush fr mymodule and it will import the new configuration without having to delete existing. As 4x4 was mentioning, this wouldn't be ideal for configuration site owners are changing, but if it's something you're updating and maintaining as the developer, it's an ideal route to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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