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