A static class providing functionality for building forms.
package |
CMS |
---|---|
license |
GPL |
author |
Robert Campbell |
since | 2.0 |
create_option(array $data, array<mixed,string>|string $selected = null) : string
Accepts an associative 'option' array with at least two populated keys: 'label' and 'value'. If 'value' is not an array then a single '
i.e: $tmp = array('label'=>'myoptgroup','value'=>array( array('label'=>'opt1','value'=>'value1'), array('label'=>'opt2','value'=>'value2') ) );
The 'option' array can have additional keys for 'title' and 'class'
i.e: $tmp = array('label'=>'opt1','value'=>'value1','title'=>'My title','class'=>'foo');
array
$dataThe option data
array<mixed,string>|string
$selectedThe selected elements
string
The generated
create_dropdown(string $name, array $list_options, string|array<mixed,string> $selected, array $params = array()) : string
string
$nameThe name attribute for the select name
array
$list_optionsOptions as per the CmsFormUtils::create_options method
string|array<mixed,string>
$selectedSelected value as per the CmsFormUtils::create_option method
array
$paramsArray of additional options including: multiple,class,title,id,size
string
The HTML content for the
create_textarea(array $parms) : string
parameters: name = (required string) name attribute for the text area element. id = (optional string) id attribute for the text area element. If not specified, name is used. class/classname = (optional string) class attribute for the text area element. Some values will be added to this string. default is cms_textarea forcemodule = (optional string) used to specify the module to enable. If specified, the module name will be added to the class attribute. enablewysiwyg = (optional boolan) used to specify wether a wysiwyg textarea is required. sets the language to html. wantedsyntax = (optional string) used to specify the language (html,css,php,smarty) to use. If non empty indicates that a syntax hilighter module is requested. cols/width = (optional integer) columns of the text area (css or the syntax/wysiwyg module may override this) rows/height = (optional integer) rows of the text area (css or the syntax/wysiwyg module may override this) maxlength = (optional integer) maxlength attribute of the text area (syntax/wysiwyg module may ignore this) required = (optional boolean) indicates a required field. placeholder = (optional string) placeholder attribute of the text area (syntax/wysiwyg module may ignore this) value/text = (optional string) default text for the text area, will undergo entity conversion. encoding = (optional string) default utf-8 encoding for entity conversion. addtext = (optional string) additional text to add to the textarea tag. cssname = (optional string) Pass this stylesheet name to the WYSIWYG area if any.
note: if wantedsyntax is empty, AND enablewysiwyg is false, then just a plain text area is creeated.
array
$parmsAn associative array with parameters.
string