You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
1.8 KiB

  1. <?php
  2. /**
  3. * Class helper_plugin_bureaucracy_fieldstatic
  4. *
  5. * Adds some static text to the form
  6. */
  7. class helper_plugin_bureaucracy_fieldstatic extends helper_plugin_bureaucracy_field {
  8. protected $tpl = '<p>@@DISPLAY@@</p>';
  9. /**
  10. * Arguments:
  11. * - cmd
  12. * - text
  13. *
  14. * @param array $args The tokenized definition, only split at spaces
  15. */
  16. public function initialize($args) {
  17. parent::initialize($args);
  18. // make always optional to prevent being marked as required
  19. $this->opt['optional'] = true;
  20. }
  21. /**
  22. * Handle a post to the field
  23. *
  24. * @param string $value The passed value
  25. * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field)
  26. * @param int $index index number of field in form
  27. * @param int $formid unique identifier of the form which contains this field
  28. * @return bool Whether the passed value is valid
  29. */
  30. public function handle_post($value, &$fields, $index, $formid) {
  31. return true;
  32. }
  33. /**
  34. * Get an arbitrary parameter
  35. *
  36. * @param string $name
  37. * @return mixed|null
  38. */
  39. public function getParam($name) {
  40. return ($name === 'value') ? null : parent::getParam($name);
  41. }
  42. /**
  43. * Render the field as XHTML
  44. *
  45. * @params array $params Additional HTML specific parameters
  46. * @params Doku_Form $form The target Doku_Form object
  47. * @params int $formid unique identifier of the form which contains this field
  48. */
  49. public function renderfield($params, Doku_Form $form, $formid) {
  50. if (!isset($this->opt['display'])) {
  51. $this->opt['display'] = $this->opt['label'];
  52. }
  53. parent::renderfield($params, $form, $formid);
  54. }
  55. }