views_plugin_argument_default_fixed.inc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_plugin_argument_default_fixed.
  5. */
  6. /**
  7. * The fixed argument default handler.
  8. *
  9. * @ingroup views_argument_default_plugins
  10. */
  11. class views_plugin_argument_default_fixed extends views_plugin_argument_default {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function option_definition() {
  16. $options = parent::option_definition();
  17. $options['argument'] = array('default' => '');
  18. return $options;
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function options_form(&$form, &$form_state) {
  24. parent::options_form($form, $form_state);
  25. $form['argument'] = array(
  26. '#type' => 'textfield',
  27. '#title' => t('Fixed value'),
  28. '#default_value' => $this->options['argument'],
  29. );
  30. }
  31. /**
  32. * Return the default argument.
  33. */
  34. public function get_argument() {
  35. return $this->options['argument'];
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function convert_options(&$options) {
  41. if (!isset($options['argument']) && isset($this->argument->options['default_argument_fixed'])) {
  42. $options['argument'] = $this->argument->options['default_argument_fixed'];
  43. }
  44. }
  45. }
  46. /**
  47. * @}
  48. */