0

I am trying to add a new view to an existing module. I created the view using Views UI and exported its YML to the 'config/optional' folder. If I install the module for the first time, the view is enabled in Views UI.

When I add the view to an existing site, it won't activate no matter what I do. I've tried clearing caches, looked for examples in core & contributed modules and searched the documentation for possible hook_update examples. The only thing I found was in 'Create or update a View' section at https://www.drupal.org/docs/7/creating-custom-modules/howtos/examples-for-database-update-scripts-using-hook_update_n-how but it's for Drupal 7. The PHP code looks like it would work for Drupal 8 but I haven't been able to find a way to export a view as code.

2

0

Your Answer

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

Browse other questions tagged or ask your own question.