1<?php
2/**
3 * Class helper_plugin_bureaucracy_fieldhiddenautoinc
4 *
5 * Creates an invisible field with a number that increases by 1 on each form submit
6 */
7class helper_plugin_bureaucracy_fieldhiddenautoinc extends helper_plugin_bureaucracy_fieldnumber {
8
9    /**
10     * Arguments:
11     *  - cmd
12     *  - label
13     *
14     * @param array $args The tokenized definition, only split at spaces
15     */
16    function initialize($args) {
17        $args[] = '++';
18        parent::initialize($args);
19    }
20
21    /**
22     * Render the field as XHTML
23     *
24     * Outputs the represented field using the passed Doku_Form object.
25     *
26     * @param array     $params Additional HTML specific parameters
27     * @param Doku_Form $form   The target Doku_Form object
28     * @param $formid
29     */
30    function renderfield($params, Doku_Form $form, $formid) {
31        $this->_handlePreload();
32        $form->addHidden($params['name'], $this->getParam('value') . '');
33    }
34
35}
36