We're writing some update functions for a custom module. This custom module provides some views:
/**
* Implements hook_views_default_views().
*/
function mymodule_views_default_views() {
$views_dir = drupal_get_path('module', 'mymodule') . '/views';
$views_files = scandir($views_dir);
$views = array();
foreach ($views_files as $filename) {
if (substr($filename, -4) == '.inc') {
include_once $views_dir . '/' . $filename;
}
}
return $views;
}
There are several .inc
files from the view export ui and all those views are provided.
Now: some of those views should be updated. We usually just export and re-import them using the view ui (and override existing views). We wondered, how would this be possible programmatically? How to tell views which files to import again and override?
function mmodule_update_7001() {
// what goes here?
}
Thanks for any ideas!