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.
 
 
 
 
 

64 lines
1.9 KiB

  1. <?php
  2. /**
  3. * Class helper_plugin_bureaucracy_fieldaddpage
  4. *
  5. * Adds another page page_tgt based on a template page page_tpl only for use with the template action
  6. */
  7. class helper_plugin_bureaucracy_fieldaddpage extends helper_plugin_bureaucracy_field {
  8. /**
  9. * Arguments:
  10. * - cmd
  11. * - page_tpl
  12. * - page_tgt
  13. *
  14. * @param array $args The tokenized definition, only split at spaces
  15. */
  16. function initialize($args) {
  17. if(count($args) < 3){
  18. msg(sprintf($this->getLang('e_missingargs'), hsc($args[0]),
  19. hsc($args[1])), -1);
  20. return;
  21. }
  22. // get standard arguments
  23. $this->opt = array_combine(array('cmd', 'page_tpl', 'page_tgt'), $args);
  24. }
  25. /**
  26. * Nothing displayed
  27. *
  28. * @params array $params Additional HTML specific parameters
  29. * @params Doku_Form $form The target Doku_Form object
  30. * @params int $formid unique identifier of the form which contains this field
  31. */
  32. function renderfield($params, Doku_Form $form, $formid) {
  33. }
  34. /**
  35. * Handle a post to the field
  36. *
  37. * @param string $value null
  38. * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field)
  39. * @param int $index index number of field in form
  40. * @param int $formid unique identifier of the form which contains this field
  41. * @return bool Whether the passed value is valid
  42. */
  43. function handle_post($value, &$fields, $index, $formid) {
  44. return true;
  45. }
  46. /**
  47. * Get an arbitrary parameter
  48. *
  49. * @param string $name
  50. * @return mixed|null
  51. */
  52. function getParam($name) {
  53. return ($name === 'value' ||
  54. (in_array($name, array('page_tpl', 'page_tgt')) && $this->hidden)) ?
  55. null :
  56. parent::getParam($name);
  57. }
  58. }