views_plugin_argument_default_fixed.inc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @file
  4. * Contains the fixed argument default plugin.
  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. function option_definition() {
  13. $options = parent::option_definition();
  14. $options['argument'] = array('default' => '');
  15. return $options;
  16. }
  17. function options_form(&$form, &$form_state) {
  18. parent::options_form($form, $form_state);
  19. $form['argument'] = array(
  20. '#type' => 'textfield',
  21. '#title' => t('Fixed value'),
  22. '#default_value' => $this->options['argument'],
  23. );
  24. }
  25. /**
  26. * Return the default argument.
  27. */
  28. function get_argument() {
  29. return $this->options['argument'];
  30. }
  31. function convert_options(&$options) {
  32. if (!isset($options['argument']) && isset($this->argument->options['default_argument_fixed'])) {
  33. $options['argument'] = $this->argument->options['default_argument_fixed'];
  34. }
  35. }
  36. }
  37. /**
  38. * @}
  39. */