1

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.

1

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.

  • Thank you, this fixed it. I have a question though, in my original file naming convention, I put 'view' there for my own sake, to recognize this as a view and not another entity. When I did your approach, Views.view.(whatever here), it works, but if I put Views.(whatever here), it does not work. It requires Views.view. Where can I find documentation regarding this so I know how to properly name things? Otherwise, I am blind and guessing in the dark. – Shawn May 13 at 12:00
  • 1
    You can go to admin > config sync > export > single item. Then under the text area you will see the name of the config file once you’ve made a selection. – Prestosaurus May 13 at 14:39
0

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
  • The file is named incorrectly so the config never gets installed in the first place (hence no duplicate config error message) – Clive May 13 at 9:03

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.