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.
 
 
 
 
 

48 lines
1.3 KiB

  1. <?php
  2. /**
  3. * Class helper_plugin_bureaucracy_fieldhidden
  4. *
  5. * Creates an invisible field with static data
  6. */
  7. class helper_plugin_bureaucracy_fieldhidden extends helper_plugin_bureaucracy_field {
  8. /**
  9. * Arguments:
  10. * - cmd
  11. * - label
  12. * - =default value
  13. */
  14. /**
  15. * Render the field as XHTML
  16. *
  17. * Outputs the represented field using the passed Doku_Form object.
  18. *
  19. * @param array $params Additional HTML specific parameters
  20. * @param Doku_Form $form The target Doku_Form object
  21. * @param int $formid unique identifier of the form which contains this field
  22. */
  23. function renderfield($params, Doku_Form $form, $formid) {
  24. $this->_handlePreload();
  25. $form->addHidden($params['name'], $this->getParam('value') . '');
  26. }
  27. /**
  28. * Get an arbitrary parameter
  29. *
  30. * @param string $name
  31. * @return mixed|null
  32. */
  33. function getParam($name) {
  34. if (!isset($this->opt[$name]) || in_array($name, array('pagename', 'value')) && $this->hidden) {
  35. return null;
  36. }
  37. if ($name === 'pagename') {
  38. // If $this->opt['pagename'] is set, return the value of the field,
  39. // UNESCAPED.
  40. $name = 'value';
  41. }
  42. return $this->opt[$name];
  43. }
  44. }