diff options
Diffstat (limited to 'platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php')
-rw-r--r-- | platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php b/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php new file mode 100644 index 0000000..430cc2d --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php @@ -0,0 +1,34 @@ +<?php +/** + * Class helper_plugin_bureaucracy_fieldtextbox + * + * Creates a single line input field + */ +class helper_plugin_bureaucracy_fieldtextbox extends helper_plugin_bureaucracy_field { + + /** + * Arguments: + * - cmd + * - label + * - =default (optional) + * - ^ (optional) + * + * @param array $args The tokenized definition, only split at spaces + */ + function initialize($args) { + parent::initialize($args); + + $attr = array(); + if(!isset($this->opt['optional'])) { + $attr['required'] = 'required'; + } + + $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + if(isset($this->opt['class'])){ + $this->tpl['class'] .= ' '.$this->opt['class']; + } + if(!isset($this->opt['optional'])){ + $this->tpl['class'] .= ' required'; + } + } +} |