Last updated: Mon, Apr 17, 2023 10:43 am
Return to Knowledgebase
# | Parameter | Data Type | Required | Description |
---|---|---|---|---|
1 | $type | string | Yes | the type of input field (e.g. "text", "password", "email", etc.) |
2 | $label | string | Yes | the label text for the input field |
3 | $id | string | Yes | the ID of the input field |
4 | $divAttr=array | array | No | associative array parameter representing the attributes and their values to be added to the div element that contains the label and input element |
5 | $inputAttr | No | an optional associative array parameter representing the attributes and their values to be added to the input element | |
6 | No | |||
7 | No |
Data Type | Description of Returned Data |
---|---|
string | Represents an HTML input block with label, input field, and helper text (if provided) wrapped in a div element. |
// generate an input block for a text field with a label and help button
echo inputBlock('username', 'Username', 'text', array('class' => 'form-group'), array('class' => 'form-control'), 'Enter your desired username', 'Your username must be at least 6 characters long and can only contain letters and numbers.');
// generate an input block for a password field with a label and no help button
echo inputBlock('password', 'Password', 'password', array('class' => 'form-group'), array('class' => 'form-control'), '', '');
?>