Skip to content
Snippets Groups Projects
Commit 7df9cd6d authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

handle checkboxes, radios, hidden

parent 27bf6226
Branches
No related tags found
1 merge request!9Add textarea
......@@ -404,13 +404,13 @@ class renderadminlte {
'input'=>[
'label'=>'Form: input',
'description'=>'Input form fiels',
'method'=>'getInput',
'method'=>'getFormInput',
'params'=>[
'label' => [
'group'=>'styling',
'description'=>'label for the input field',
'example_value'=>'Enter your firstname'
'example_value'=>'Enter something'
],
'type'=>['select'=> [
'description'=>'type or input field',
......@@ -455,12 +455,12 @@ class renderadminlte {
'prepend' => [
'group'=>'styling',
'description'=>'optional: content on input start',
'example_value'=>'+'
'example_value'=>''
],
'append' => [
'group'=>'styling',
'description'=>'optional: content on input end',
'example_value'=>':-)'
'example_value'=>''
],
'name' => [
'group'=>'content',
......@@ -474,6 +474,44 @@ class renderadminlte {
],
]
],
// ------------------------------------------------------------
'textarea'=>[
'label'=>'Form: textarea',
'description'=>'textarea or html editor',
'method'=>'getFormTextarea',
'params'=>[
'label' => [
'group'=>'styling',
'description'=>'label for the input field',
'example_value'=>'Enter text'
],
'type'=>['select'=> [
'description'=>'type or input field',
'group'=>'styling',
'values'=>[
''=>'text',
'html'=>'html editor',
]
],
],
'class' => [
'group'=>'styling',
'description'=>'optional: css classes',
'example_value'=>'myclass'
],
'name' => [
'group'=>'content',
'description'=>'name attribute',
'example_value'=>'textdata'
],
'value' => [
'group'=>'content',
'description'=>'Value',
'example_value'=>'Here is some text...'
],
]
],
];
}
/**
......@@ -1246,11 +1284,25 @@ class renderadminlte {
}
}
return $this->getHorizontalFormElement(
$sPrepend.$this->_tag('input', $aElement, '', false).$sAppend,
$sLabel,
$sFormid
);
// return data
switch($aElement['type']){
case 'checkbox':
case 'radio':
$aElement['class']=str_replace('form-control ', 'form-check-input', $aElement['class']);
return $this->_tag('div' , ['class'=>'form-check'],
$this->_tag('input', $aElement, '', false).$this->_tag('label', ['for'=>$sFormid, 'label'=>$sLabel ], '')
);
break;
case 'hidden':
return $this->_tag('input', $aElement, '', false);
break;
default: return $this->getHorizontalFormElement(
$sPrepend.$this->_tag('input', $aElement, '', false).$sAppend,
$sLabel,
$sFormid
);
}
}
/**
......@@ -1258,7 +1310,7 @@ class renderadminlte {
* @param type $aOptions hash with keys for all options
* styling:
* - type - field type: [none]|html
* content
* content
* - label - label tag
* - name - name attribute for sending form
* - value - value in
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment