Question

I have created a view and then exported it normally to a yml file. Then I put this yml file into my mycustommodule/config/install folder.

So current its named mycustommodule.view.user_assigned.yml

However when I uninstall the module and reinstall it to see if it will upload the view, it does not. What am I doing wrong?

Edit: I copied and pasted the yml file itself so there should be no errors there. The only thing I did was remove the UUID string since I read elsewhere it was not needed.

Was it helpful?

Solution

The first part of a config item filename is the module responsible for the config type, not the module installing it.

In your case that's "views", so the file should be named views.view.user_assigned.yml.

OTHER TIPS

This is by concept, uninstalling a module does not remove config listed in config/install - and therefore the config also won't also update through reinstalling. (Actually I thought there even would be some error message like "can't install because config object already exists")

But you can add an enforced dependency to your config, which will delete the config object when you uninstall the module (and therefore also update it when you reinstall it).

Add this to your .yml

dependencies:
  enforced:
    module:
      - mycustommodule
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top