summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/bureaucracy/helper/fieldhiddenautoinc.php
blob: 787e081e92b9968b3876cb3f31fe64292335f1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
 * Class helper_plugin_bureaucracy_fieldhiddenautoinc
 *
 * Creates an invisible field with a number that increases by 1 on each form submit
 */
class helper_plugin_bureaucracy_fieldhiddenautoinc extends helper_plugin_bureaucracy_fieldnumber {

    /**
     * Arguments:
     *  - cmd
     *  - label
     *
     * @param array $args The tokenized definition, only split at spaces
     */
    function initialize($args) {
        $args[] = '++';
        parent::initialize($args);
    }

    /**
     * Render the field as XHTML
     *
     * Outputs the represented field using the passed Doku_Form object.
     *
     * @param array     $params Additional HTML specific parameters
     * @param Doku_Form $form   The target Doku_Form object
     * @param $formid
     */
    function renderfield($params, Doku_Form $form, $formid) {
        $this->_handlePreload();
        $form->addHidden($params['name'], $this->getParam('value') . '');
    }

}