How to create views (programs) programmatically when installing a module?

I wrote my own module of deferred goods, it works as it should, I want to simplify the task, it remains only to create special views (views) with the necessary settings.

Core: Drupal 7x

    1 answer 1

    You must define hook hook_views_default_views . Under the link you will see the official documentation on it and examples. I recommend to create the necessary views, to make the export, to put the resulting code inside the given hook. I also recommend to see how it is implemented in the contact modules, for example, in the commerce module. And it’s better how they are implemented in the Views module itself (modules folder), for example, the node.views_default.inc file

    • Thanks for the article and examples, I thought so, but I didn’t have enough to see examples :) - SHTIKOV
    • added more where to see examples. thanks say here: mark the correct answer or with the arrow up - Alex