Revision 56aebcb7
Added by Assos Assos about 8 years ago
drupal7/sites/all/modules/views_data_export/views_data_export.drush.inc | ||
---|---|---|
17 | 17 |
'output_file' => 'The file to write the results to - will be overwritten if it already exists', |
18 | 18 |
), |
19 | 19 |
'options' => array ( |
20 |
'--arguments' => 'Comma separated list of arguments to be passed to the view.',
|
|
21 |
'--format' => 'csv,doc,txt,xls or xml. These options are ignored if the display_id passed is a "views_data_export" display.',
|
|
22 |
'--separator' => 'csv only: What character separates the fields (default:,)',
|
|
23 |
'--trim-whitespace' => 'csv only: Trim whitespace from either side of fields (default:1)',
|
|
24 |
'--header-row' => 'csv only: Make the first row a row of headers (default:1)',
|
|
25 |
'--quote-values' => 'csv only: Surround each field in quotes (default:1)',
|
|
20 |
'arguments' => 'Comma separated list of arguments to be passed to the view.', |
|
21 |
'format' => 'csv,doc,txt,xls or xml. These options are ignored if the display_id passed is a "views_data_export" display.', |
|
22 |
'separator' => 'csv only: What character separates the fields (default:,)', |
|
23 |
'trim-whitespace' => 'csv only: Trim whitespace from either side of fields (default:1)', |
|
24 |
'header-row' => 'csv only: Make the first row a row of headers (default:1)', |
|
25 |
'quote-values' => 'csv only: Surround each field in quotes (default:1)', |
|
26 | 26 |
), |
27 | 27 |
'examples' => array ( |
28 | 28 |
'drush views-data-export myviewname views_data_export_1 output.csv' => 'Export myviewname:views_data_export_1 and write the output to output.csv in the current directory', |
... | ... | |
168 | 168 |
$options['output_file'] = realpath(drush_get_context('DRUSH_OLDCWD', getcwd())) . '/' . $output_file; |
169 | 169 |
} |
170 | 170 |
|
171 |
$arguments = drush_get_option('arguments', ''); |
|
172 |
$arguments = explode(',', $arguments); |
|
171 | 173 |
|
172 | 174 |
if ($view->display_handler->is_batched()) { |
173 | 175 |
// This is a batched export, and needs to be handled as such. |
174 | 176 |
_drush_views_data_export_override_batch($view_name, $display_id, $options); |
175 | 177 |
|
176 |
$arguments = drush_get_option('arguments', ''); |
|
177 |
$arguments = explode(',', $arguments); |
|
178 | 178 |
$view->execute_display($display_id, $arguments); |
179 | 179 |
} |
180 | 180 |
else { |
181 | 181 |
// This export isn't batched. |
182 | 182 |
ob_start(); |
183 |
$view->execute_display($display_id); |
|
183 |
$view->execute_display($display_id, $arguments);
|
|
184 | 184 |
// Get the results, and clean the output buffer. |
185 | 185 |
$result = ob_get_contents(); |
186 | 186 |
// Clean the buffer. |
Also available in: Unified diff
Weekly update of contrib modules