1<?php
2/**
3 * Class helper_plugin_bureaucracy_fieldpassword
4 *
5 * Creates a single line password input field
6 */
7class helper_plugin_bureaucracy_fieldpassword extends helper_plugin_bureaucracy_field {
8    /**
9     * Arguments:
10     *  - cmd
11     *  - label
12     *  - ^ (optional)
13     *
14     * @param array $args The tokenized definition, only split at spaces
15     */
16    function initialize($args) {
17        parent::initialize($args);
18
19        $attr = array();
20        if(!isset($this->opt['optional'])) {
21            $attr['required'] = 'required';
22        }
23        $this->tpl = form_makePasswordField('@@NAME@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr);
24
25        if(!isset($this->opt['optional'])){
26            $this->tpl['class'] .= ' required';
27        }
28    }
29}
30