Posted by stevector on April 4, 2011 at 6:57pm
5 followers
Jump to:
| Project: | Chaos tool suite (ctools) |
| Version: | 7.x-1.x-dev |
| Component: | Bulk Exporter |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
There was a request last year in Features issue queue by kenorb for exporting Views into separate files.
#747028: Views export into separate files
The response from yhahn was that such functionality should first happen in CTools/Views. I looked for a ticket in the in the CTools and Views queues but could not find one. Has this been discussed previously? Could this be done with patches to the Bulk Export module?
Comments
#1
I have thought about it but I have not yet moved forward on it, nor am have I quite decided the best way to actually do it. Bulk exporting a lot of different files is a little tricker; you need to move past cut & paste and actually produce files, at that point.
#2
Here's what we do:
<?php
/**
* Implements hook_views_default_views().
*/
function mymodule_views_default_views() {
$files = file_scan_directory(drupal_get_path('module', 'mymodule'). '/views/views', '/inc$/');
foreach ($files as $filename => $file) {
require $filename;
$views[$file->name] = $view;
}
return $views;
}
/**
* Implements hook_views_default_views_alter().
*/
function mymodule_views_default_views_alter(&$views) {
$files = file_scan_directory(drupal_get_path('module', 'mymodule'). '/views/altered', '/inc$/');
foreach ($files as $filename => $file) {
if (isset($views[$file->name])) {
require $filename;
$views[$file->name] = $view;
}
}
}
?>
Works pretty well. Then, we just drop all of our views into mymodule/views/views and name them the name of the view. When we want to export altered views provided by other modules, we put them in mymodule/views/altered.
#3
Thanks joelstein. Do you have an automated way of getting those exported Views into mymodule/views/views the way Features or Bulk Export can?
#4
Well, as long as the file exists in the mymodule/views/views folder, Views will find it.
#5
#6
I'm working on this functionality for Features module in a sandbox: http://drupal.org/sandbox/stevector/1392162