I have a theme that imports configuration when is installed. The problem is when the configuration is already there and is active.

Unable to install MYTHEME, field.field.user.user.user_picture, field.storage.node.body, field.storage.node.field_image, field.storage.user.user_picture, node.type.article, views.view.frontpage already exist in active configuration.

I know these errors are because the configuration is already on the site.

How can I override the configuration with a new configuration that is carried from my theme?

1 Answer 1


You cannot. You can provide only configuration for your module or create new configuration entities. You can "override" the default configuration only by profile, not module or theme.

But you can use hook_install to programmatically override whatever you want.

When it comes to themes, the only configuration that you should provide is block instances and your theme's settings. Of course if you have some advanced blocks you can also provide block types and field storage and instances for them.

  • its possible to override all my configuration files ? If so how ? hook_install example that I have seen are very specify to a value but I have not seen an example that it overrides the entire file. Jan 11, 2016 at 13:04
  • To override existing configuration use \Drupal::configFactory()->getEditable($name) instead of \Drupal:config($name) since the latter is read-only.
    – user21641
    Jan 11, 2016 at 13:08
  • $name = to the name of file ? Jan 11, 2016 at 13:09
  • 1
    I have run to so many issues try to "overwrite" configuration. Its better to avoid doing that.. Jan 17, 2016 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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