views_data_export.views.inc 5.6 KB

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