views_data_export_plugin_style_export_xml.inc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @file
  4. * Plugin include file for export style plugin.
  5. */
  6. /**
  7. * Generalized style plugin for export plugins.
  8. *
  9. * @ingroup views_style_plugins
  10. */
  11. class views_data_export_plugin_style_export_xml extends views_data_export_plugin_style_export {
  12. /**
  13. * Set options fields and default values.
  14. *
  15. * @return
  16. * An array of options information.
  17. */
  18. function option_definition() {
  19. $options = parent::option_definition();
  20. $options['transform'] = array(
  21. 'default' => TRUE,
  22. 'translatable' => FALSE,
  23. );
  24. $options['transform_type'] = array(
  25. 'default' => 'dash',
  26. 'translatable' => FALSE,
  27. );
  28. return $options;
  29. }
  30. /**
  31. * Options form mini callback.
  32. *
  33. * @param $form
  34. * Form array to add additional fields to.
  35. * @param $form_state
  36. * State of the form.
  37. * @return
  38. * None.
  39. */
  40. function options_form(&$form, &$form_state) {
  41. parent::options_form($form, $form_state);
  42. $form['transform'] = array(
  43. '#type' => 'checkbox',
  44. '#title' => t('Transform spaces'),
  45. '#default_value' => $this->options['transform'],
  46. '#description' => t('Transform spaces to valid XML in field labels (spaces create invalid XML markup). Note that invalid XML tag characters will always be converted.'),
  47. );
  48. $form['transform_type'] = array(
  49. '#type' => 'select',
  50. '#title' => t('Transform type'),
  51. '#default_value' => $this->options['transform_type'],
  52. '#options' => array(
  53. 'dash' => t('Dash'),
  54. 'underline' => t('Underline'),
  55. 'camel' => t('camelCase'),
  56. 'pascal' => t('PascalCase'),
  57. ),
  58. '#process' => array('ctools_dependent_process'),
  59. '#dependency' => array(
  60. 'edit-style-options-transform' => array(TRUE),
  61. ),
  62. );
  63. }
  64. }