In previous articles (here and here), we have seen a method to add custom views and data in MyModule.
With Drupal 8 there is a very easy and practical way to add this custom view as a configuration that will be installed with the module.
1) extract the configuration data
Navigate to "/admin/config/development/configuration/single/export".
On this page, select configuration type 'view' and configuration name 'My module list' that was created earlier.
2) create configuration install file
You will obtain from the above export a list of configuration data that you can copy and paste into a file called for instance "views.view.mymodule-list.yml";
Simply place this file into the install folder :
Upon installation of the module, the view will be automatically created.
We hope this demonstration is helpful to you. You can view as well another demo in our custom module address book , part of EK management tools that use the same technique.
If you have comments or want to add techniques to improve views of custom data, feel free to do so.
Add new comment