I have a custom module. On its installation I want to set some configuration settings of views like:


to TRUE.

For this I have added a file mymod_views.settings.yml to modules/mymod/config/install/. the content of the file is:

    additional_queries: true
    advanced_column: true
    master_display: true
    performance_statistics: true
    preview_information: true
      enabled: true
      where: above
    display_embed: false
  always_live_preview: false

But on the installation of the module I am getting the following exception.

exception 'Drupal\Core\Config\PreExistingConfigException' with message 'Configuration objects (mymod_views.settings) provided by mymod already
exist in active configuration' in

Can someone tells me how I will set these options through my module?


It is not possible to change or override configuration from other modules like that, you can only provide new, not yet existing configuration in config/install. The only exception to that rule are install profiles.

Instead, you need to implement hook_install() and alter the configuration there. See locale_install() for example:

  ->set('ui.show.master_display', TRUE)
| improve this answer | |

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.