Creating views view in your module is really simple.
Source code viewer
// 1. Create your view the regular way. // 2. Define your views api version and path for files that include views hooks. This goes to .module file. /** * Implements hook_views_api(). */ function HOOK_views_api() { 'api' => 3.0, 'path' => drupal_get_path('module', 'HOOK') . '/views', ); } // 3. Views export creates code that you have to paste in this function. This goes to MODULENAME.views_default.inc and it will be auto-loaded. /** * Implements hook_views_default_views(). */ function HOOK_views_default_views() { // Paste code form views export. $views[$view->name] = $view; return $views; } // 4. Delete your view and clear all caches, view from your code should appear. When you change the view don't forget to add the changes to code.Programming Language: PHP