Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Mar 2011 at 20:57 UTC
Updated:
5 Jun 2019 at 18:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
DjebbZ commentedGreat idea. I would like it too. But I don't understand the --all argument. How can it create separate files since files are created in the command line (
> [view_name].view.php) ?According to you, should the export from the drush command also produces lines like (I'm not exactly sure of the syntax) :
Comment #2
dww--all would be instead of printing to stdout and redirecting to a file. In fact, by default it could attempt to create [view_name].view.php in the current directory. If that already exists, it'd prompt you if it should overwrite. And/or you could specify a path for the output as a different arg.
And no, it doesn't need to include a hook_views_default_views() implementation. That'd look something like this:
So, any file ending in .view.php in the appropriate directory (up to the module using this) would be considered a default view.
Cheers,
-Derek
Comment #3
gregglesThere is also a separate module - http://drupal.org/project/drush_views
I would personally like for that to be integrated into views itself. Most modules provide their own drush commands rather than having to have a separate module for them (I know Views isn't "most modules").
Comment #4
DjebbZ commentedI posted in its issue queue (#1165992: Conflicts with latest Views enhancements) about deprecating drush_views and integrating/adjusting the commands provided into Views.
Comment #5
manuel garcia commentedThat project has been a year without any activity... shame.
I agree with #2
Comment #6
effulgentsia commentedHere's a start at a 'views-export' and a 'views-import' command. It's based on the code in http://drupal.org/project/drush_views (6.x-3.x), with the following changes:
Comment #7
effulgentsia commentedMarked #1096668: Add drush views-import command (or maybe just views-convert) a duplicate. I think it makes sense to review these together, but if I'm mistaken, please say so, and reopen the other issue.
Comment #8
merlinofchaos commentedSince we're powered by CTools, shouldn't we be using CTools import/export drush commands?
Comment #9
effulgentsia commentedDo those exist already, or do they need to be written?
Comment #10
merlinofchaos commentedsome, maybe not all of the ones you wrote.
Comment #11
dawehnerCurrently there is just export: #1385772: Add Drush Bulk export command
Comment #12
manuel garcia commentedThere's also #1084062: Drush command to revert overridden ctools exported objects which I suppose is the way we should be working in the future.
Comment #13
tim.plunkettTriggering the testbot.
Comment #15
pescetti commentedFor the record, I just made a new version (3.0) of Drush Views available at http://drupal.org/project/drush_views
It includes all improvements that had been proposed to the import/export functionality (like exporting by tag, or by status, exporting to individual .inc files suitable for inclusion by hook_views_default_views(), bulk-exporting to stdout in a format suitable for inclusion in a .module file), as well as several functions that are out of scope in this issue (listing displays in a view, or theme functions applying to a particular display, or copy settings between views).
Feel free to take everything worth including in Views.
As explained in the module page, no further development of Drush Views as an independent module is planned: I agree it's best to move this functionality into Views itself.
Comment #16
merlinofchaos commentedIf you would like co-maintainership of Views for the purposes of facilitating this transfer, we can probably arrange that.
Comment #17
drzraf commentedctools related, anyway:
This fixes a warning and bad option titles at the "Select exportables." stage (when we chose to only export "some" of the available views, eg using
drush ctools-export --tables=views_viewthen Make selection [2] then Views (views_view) [1].Before:
After:
Comment #18
drzraf commentedping ?
Comment #19
manuel garcia commentedComment #21
drzraf commentedlast patch applies cleanly against latest ctools
Comment #22
nagba commentedrerolling http://drupal.org/files/views-drush-expimp.patch so it applies to views 3.6 cleanly
Comment #23
drzraf commentedComment #24
helmo commentedJust tried the patch from #22 on views 7.x-3.7 .. applies and works as expected!
The only thing I notices was a typo in an error message:
should state 'import'
Comment #25
liza commented#22 works beautifully in 3.7. could the mods please, please, please commit. thanks!
Comment #26
helmo commentedComment #27
homoludens commentedHere is patch from #22 rerolled for current dev version.
Comment #28
dawehnerDoesn't ctools now provide the necessary drush code, so views would not have to add it?
Comment #29
manuel garcia commentedCtools includes
ctools-exportandctools-export-revertcommands. Not sure if there's a usecase for importing though.Comment #30
manuel garcia commentedAfter consulting my wise pillow, I agree with @dawehner here, ctools-export should do the trick. At the very most we could should just add a wrapper command (as in views-export would call ctools export), to make it easier for users to export views if they don't know what ctools is. We certainly don't want to add more code to maintain if ctools is already providing this.
As for the import command, I don't see myself using it too much, but who knows, perhaps some people could use both to move views around - I'm thinking
drush @prod views-export viewname | drush views-importor something like that...Comment #31
yan commentedPatch from #27 works perfectly for me importing and exporting views. Thanks a lot! I spent some time trying to figure this out.
I can't really say anything about ctools.
Comment #32
nileshlohar commentedStraight reroll with latest dev release.
Comment #33
chris matthews commentedThe 2 year old patch in #32 to views.drush.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.
Comment #34
andrew answer commentedPatch rerolled.