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

add textarea

parent 4d3512a5
No related branches found
No related tags found
1 merge request!9Add textarea
......@@ -418,6 +418,8 @@ class renderadminlte {
'values'=>[
'text'=>'text',
'password'=>'password',
'email'=>'email',
'hidden'=>'hidden',
'button'=>'button',
'checkbox'=>'checkbox',
......@@ -430,12 +432,14 @@ class renderadminlte {
'image'=>'image',
'month'=>'month',
'number'=>'number',
'password'=>'password',
'radio'=>'radio',
'range'=>'range',
'reset'=>'reset',
'search'=>'search',
'submit'=>'submit',
'tel'=>'tel',
'text'=>'text',
'time'=>'time',
'url'=>'url',
'week'=>'week',
......@@ -1183,6 +1187,15 @@ class renderadminlte {
}
public function getHorizontalFormElement($sInput, $sLabel=false, $sId=false){
return '<div class="form-group row">'
. '<label for="' . $sId . '" class="col-sm-2 col-form-label">' . $sLabel . '</label>'
. '<div class="col-sm-10">'.$sInput.'</div>'
. '</div>'
;
}
/**
* return a text input field:
* https://adminlte.io/themes/v3/pages/forms/general.html
......@@ -1193,32 +1206,25 @@ class renderadminlte {
* content
* - label - label tag
* - name - name attribute for sending form
* - value - value in
* - value - value in field
* @return string
*/
public function GetInput($aOptions){
$aOptions=$this->_ensureOptions('input', $aOptions);
public function GetFormInput($aOptions){
// $aOptions=$this->_ensureOptions('input', $aOptions);
$aElement=$aOptions;
$aElement['class']=''
. $this->_addClassValue($aOptions['class'], '')
. 'form-control '
. (isset($aOptions['class']) ? $aOptions['class']: '')
;
$sFormid=(isset($aOptions['id'])
? $aOptions['id']
: (isset($aOptions['name']) ? $aOptions['name'] : 'field' ).'-'.md5(microtime(true))
);
$sLabel='';
$sLabel=isset($aOptions['label']) ? $aOptions['label'] : '';
$sPrepend='';
$sAppend='';
$sLabel.=isset($aOptions['label']) && $aOptions['label'] ? $this->_tag('label', ['for'=>$sFormid], $aOptions['label']) : '';
$aElement['id']=$sFormid;
foreach(['_infos', 'label'] as $sDeleteKey){
unset($aElement[$sDeleteKey]);
}
$sWrapperclass='form-group';
if(isset($aOptions['prepend']) && $aOptions['prepend']){
$sWrapperclass='input-group';
......@@ -1232,12 +1238,59 @@ class renderadminlte {
$this->_tag('span', ['class'=>'input-group-text'] , $aOptions['append'])
);
}
return $this->_tag('div', ['class'=>$sWrapperclass],
$sLabel
.$sPrepend
.$this->_tag('input', $aElement, '', false)
.$sAppend
$aElement['id']=$sFormid;
foreach(['_infos', 'label', 'append', 'prepend', 'debug'] as $sDeleteKey){
if(isset($aElement[$sDeleteKey])){
unset($aElement[$sDeleteKey]);
}
}
return $this->getHorizontalFormElement(
$sPrepend.$this->_tag('input', $aElement, '', false).$sAppend,
$sLabel,
$sFormid
);
}
/**
* return a textare field .. or html editor using summernote
* @param type $aOptions hash with keys for all options
* styling:
* - type - field type: [none]|html
* content
* - label - label tag
* - name - name attribute for sending form
* - value - value in
* @return string
*/
public function getFormTextarea($aOptions){
// $aOptions=$this->_ensureOptions('textarea', $aOptions);
$aElement=$aOptions;
$aElement['class']=''
. 'form-control '
. ((isset($aOptions['type']) && $aOptions['type']=='html' )? 'summernote ': '')
. (isset($aOptions['class']) ? $aOptions['class']: '')
;
$sLabel=isset($aOptions['label']) ? $aOptions['label'] : '';
$sFormid=(isset($aOptions['id'])
? $aOptions['id']
: (isset($aOptions['name']) ? $aOptions['name'] : 'field' ).'-'.md5(microtime(true))
);
$value=isset($aOptions['value']) ? $aOptions['value']: '';
foreach(['_infos', 'label', 'debug','type', 'value'] as $sDeleteKey){
if(isset($aElement[$sDeleteKey])){
unset($aElement[$sDeleteKey]);
}
}
return $this->getHorizontalFormElement(
$this->_tag('textarea', $aElement, $value),
$sLabel,
$sFormid
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment