Table of Contents
Input
Draw an input field and a label with horizontal direction.
Syntax
$renderAdminLTE->getFormInput($aOptions);
Return
{string} html code
Parameters
- $aOptions - {array} options to describe the element
Styling:
Key | Description |
---|---|
class | optional: additional css classes |
append | optional: content on input start |
prepend | optional: content on input end |
type | field type: text, email, password, hidden and all other html 5 input types |
Content:
Key | Description |
---|---|
label | label in front of the input element |
name | name attribute for sending form data |
value | value of the input field/ visible text; for checkbox and radio: the data to send when sending a form |
Example
Simple text input field
$renderAdminLTE->getFormInput(array (
'label' => 'Enter firstname',
'type' => 'text',
'name' => 'firstname',
'value' => '',
));
You get a label, an input field wrapped in a <div class="form-group row">
.
<div class="form-group row">
<label for="firstname-27ece2891a0275dd604732b681fc666f" class="col-sm-2 col-form-label">
Enter firstname
</label>
<div class="col-sm-10">
<input type="text" class="form-control myclass" name="firstname" value="" id="firstname-27ece2891a0275dd604732b681fc666f"/>
</div>
</div>
Text input with append/ prepend
With using append and prepend keys you can create gray boxes on left and right. Add a character, an icon or html code for the addon content.
Radio and checkboxes
For these input types you can use multiple elements.
You must wrap a bunch of input elements into <div class="form-group row">
“manually”.
echo '<div class="form-group">'
. $renderAdminLTE->getFormInput([
'type' => 'checkbox',
'label' => 'first option',
'name' => 'first',
'value' => 'yes',
])
. $renderAdminLTE->getFormInput([
'type' => 'checkbox',
'label' => 'second option',
'name' => 'second',
'value' => 'yes',
])
.'</div>'
;