1 | <?php |
---|
2 | /** |
---|
3 | * @file |
---|
4 | * Views include file with views hooks. |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * Implementation of hook_views_plugins(). |
---|
9 | */ |
---|
10 | function views_data_export_views_plugins() { |
---|
11 | $path = drupal_get_path('module', 'views_data_export'); |
---|
12 | |
---|
13 | $style_defaults = array( |
---|
14 | 'path' => $path . '/plugins', |
---|
15 | 'parent' => 'views_data_export', |
---|
16 | 'theme' => 'views_data_export', |
---|
17 | 'theme path' => $path . '/theme', |
---|
18 | 'theme file' => 'views_data_export.theme.inc', |
---|
19 | 'uses row plugin' => FALSE, |
---|
20 | 'uses fields' => TRUE, |
---|
21 | 'uses options' => TRUE, |
---|
22 | 'type' => 'data_export', |
---|
23 | ); |
---|
24 | |
---|
25 | return array( |
---|
26 | 'display' => array ( |
---|
27 | 'views_data_export' => array( |
---|
28 | 'title' => t('Data export'), |
---|
29 | 'help' => t('Export the view results to a file. Can handle very large result sets.'), |
---|
30 | 'path' => $path . '/plugins', |
---|
31 | 'handler' => 'views_data_export_plugin_display_export', |
---|
32 | 'parent' => 'feed', |
---|
33 | 'uses hook menu' => TRUE, |
---|
34 | 'use ajax' => FALSE, |
---|
35 | 'use pager' => FALSE, |
---|
36 | 'accept attachments' => FALSE, |
---|
37 | 'admin' => t('Data export'), |
---|
38 | 'help topic' => 'display-data-export', |
---|
39 | ), |
---|
40 | ), |
---|
41 | 'style' => array( |
---|
42 | 'views_data_export' => array( |
---|
43 | // this isn't really a display but is necessary so the file can |
---|
44 | // be included. |
---|
45 | 'no ui' => TRUE, |
---|
46 | 'handler' => 'views_data_export_plugin_style_export', |
---|
47 | 'path' => $path . '/plugins', |
---|
48 | 'theme path' => $path . '/theme', |
---|
49 | 'theme file' => 'views_data_export.theme.inc', |
---|
50 | ), |
---|
51 | 'views_data_export_csv' => array( |
---|
52 | 'title' => t('CSV file'), |
---|
53 | 'help' => t('Display the view as a comma separated list.'), |
---|
54 | 'handler' => 'views_data_export_plugin_style_export_csv', |
---|
55 | // Views Data Export element that will be used to set additional headers when serving the feed. |
---|
56 | 'export headers' => array('Content-type: text/csv; charset=utf-8'), |
---|
57 | // Views Data Export element mostly used for creating some additional classes and template names. |
---|
58 | 'export feed type' => 'csv', |
---|
59 | 'export feed text' => 'CSV', |
---|
60 | 'export feed file' => '%view.csv', |
---|
61 | 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/csv.png', |
---|
62 | 'additional themes' => array( |
---|
63 | 'views_data_export_csv_header' => 'style', |
---|
64 | 'views_data_export_csv_body' => 'style', |
---|
65 | 'views_data_export_csv_footer' => 'style', |
---|
66 | ), |
---|
67 | 'additional themes base' => 'views_data_export_csv', |
---|
68 | ) + $style_defaults, |
---|
69 | 'views_data_export_doc' => array( |
---|
70 | 'title' => t('DOC file'), |
---|
71 | 'help' => t('Display the view as a doc file.'), |
---|
72 | 'handler' => 'views_data_export_plugin_style_export', |
---|
73 | 'export headers' => array('Content-Type: application/msword'), |
---|
74 | 'export feed type' => 'doc', |
---|
75 | 'export feed text' => 'Word Document', |
---|
76 | 'export feed file' => '%view.doc', |
---|
77 | 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/doc.png', |
---|
78 | 'additional themes' => array( |
---|
79 | 'views_data_export_doc_header' => 'style', |
---|
80 | 'views_data_export_doc_body' => 'style', |
---|
81 | 'views_data_export_doc_footer' => 'style', |
---|
82 | ), |
---|
83 | 'additional themes base' => 'views_data_export_doc', |
---|
84 | ) + $style_defaults, |
---|
85 | 'views_data_export_txt' => array( |
---|
86 | 'title' => t('TXT file'), |
---|
87 | 'help' => t('Display the view as a txt file.'), |
---|
88 | 'handler' => 'views_data_export_plugin_style_export', |
---|
89 | 'export headers' => array('Content-Type: text/plain'), |
---|
90 | 'export feed type' => 'txt', |
---|
91 | 'export feed text' => 'Plain Text Document', |
---|
92 | 'export feed file' => '%view.txt', |
---|
93 | 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/txt.png', |
---|
94 | 'additional themes' => array( |
---|
95 | 'views_data_export_txt_header' => 'style', |
---|
96 | 'views_data_export_txt_body' => 'style', |
---|
97 | 'views_data_export_txt_footer' => 'style', |
---|
98 | ), |
---|
99 | 'additional themes base' => 'views_data_export_txt', |
---|
100 | ) + $style_defaults, |
---|
101 | 'views_data_export_xls' => array( |
---|
102 | 'title' => t('XLS file'), |
---|
103 | 'help' => t('Display the view as a xls file.'), |
---|
104 | 'handler' => 'views_data_export_plugin_style_export', |
---|
105 | 'export headers' => array('Content-Type: application/vnd.ms-excel'), |
---|
106 | 'export feed type' => 'xls', |
---|
107 | 'export feed text' => 'XLS', |
---|
108 | 'export feed file' => '%view.xls', |
---|
109 | 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xls.png', |
---|
110 | 'additional themes' => array( |
---|
111 | 'views_data_export_xls_header' => 'style', |
---|
112 | 'views_data_export_xls_body' => 'style', |
---|
113 | 'views_data_export_xls_footer' => 'style', |
---|
114 | ), |
---|
115 | 'additional themes base' => 'views_data_export_xls', |
---|
116 | ) + $style_defaults, |
---|
117 | 'views_data_export_xml' => array( |
---|
118 | 'title' => t('XML file'), |
---|
119 | 'help' => t('Display the view as a txt file.'), |
---|
120 | 'handler' => 'views_data_export_plugin_style_export_xml', |
---|
121 | 'export headers' => array('Content-Type: text/xml'), |
---|
122 | 'export feed type' => 'xml', |
---|
123 | 'export feed text' => 'XML', |
---|
124 | 'export feed file' => '%view.xml', |
---|
125 | 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xml.png', |
---|
126 | 'additional themes' => array( |
---|
127 | 'views_data_export_xml_header' => 'style', |
---|
128 | 'views_data_export_xml_body' => 'style', |
---|
129 | 'views_data_export_xml_footer' => 'style', |
---|
130 | ), |
---|
131 | 'additional themes base' => 'views_data_export_xml', |
---|
132 | ) + $style_defaults, |
---|
133 | ), |
---|
134 | ); |
---|
135 | } |
---|