The Views advanced help has a small section on Bulk Exports but it's difficult to find (help/views/api-default-views) and not a start-to-finish tutorial. My next comment will contain a more newbie-friendly tutorial. Please suggest edits.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kbk’s picture

This "how to" focuses on the bulk export and version control functionality of the Views module. The following steps document how to export multiple views at once and create a module from the exported code that will allow you to revert any subsequent changes to your views.

Assumptions:
- You know how to install and enable a module
- You have views you want to bulk export; we'll call them myView1 and myView2

Modules
- Views (specifically 6.x-2.x)

1) Install Views 2 and enable (/admin/build/modules) the following modules: Views, Views exporter, Views UI

2) Navigate to the Views Administration page (admin/build/views)
- You should have "Edit | Export | Clone | Delete" options next to myView1 and myView2. Once we're done, "Delete" will become "Revert"!

3) Navigate to the Bulk Export page to export myView1 and myView2. Click Tools > Bulk Export or browse to admin/build/views/tools/export.

4) Export myView1 and myView2
- Check the boxes to the left of myView1 and myView2
- Choose a module name: my_views
- Click Export

5) Create a module from the exports
$ cd sites/all/modules
$ sudo mkdir my_views
$ cd my_views

- Create the following files, paste in the appropriate code, and place them into the my_views directory:
my_views.info
my_views.module (add a <?php tag at the beginning of this file!)
my_views.views_default.inc (add a <?php tag at the beginning of this file!)

6) Clear the cache (just to be safe!)
- Navigate to admin/settings/performance > Clear cached data

6) Enable the my_views module (admin/build/modules)
- the module name should be "my_views Export Module"

7) Navigate to the Views Admin page (admin/build/views) Verify that you now have version control abilities for myView1 and myView2.
- The right of these should now read "Edit | Export | Clone | Revert"

dawehner’s picture

That's a good tutorial!

What about making it as a patch for the advanced help? I guess it's much easier to find it directly in the module.

jdvc’s picture

Wow, that just saved me so much time. Thanks a lot!

kbk’s picture

@dereine, I can put a patch together. I'm assuming I should mimic the examples already in advanced help (i.e., help/views/example-users-by-role)?

dawehner’s picture

Sure it makes sense to look at existing examples.

If you need help with creating a patch i can help you on irc.

kbk’s picture

FileSize
3.13 KB

OK, see the attached patch. Not really sure if anything else needs to happen to make this a proper patch. Just change .txt to .html and it should fit in well with the other files in views/help.

dawehner’s picture

Assigned: Unassigned » esmerel

Isn't a .ini entry required, too? I'm not sure here.

kbk’s picture

I'm pretty sure you're correct dereine. See attached.

Notes:
example-bulk-export.txt > change file extension to html
views.help_.bulk-export.patch > patch for views.help.ini

kbk’s picture

Assigned: esmerel » Unassigned
esmerel’s picture

Status: Needs review » Fixed

Committed to 6.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.