Skip to main content

Input Text

get_input_text

PHP Developer Guide: get_input_text Function

This guide explains how to use the get_input_text function from your PHP framework. This function generates a styled HTML <input type="text"> or <input type="password"> field using your custom input rendering engine. And a lot of custom input elements.

It supports:

  • Readonly rendering
  • Custom classes, placeholders, and attributes

Manual Example with get_input_text

{
"element": [{
"input_text": {
"title": "Username",
"name": "username",
"placeholder": "Enter your username"
}
}]
}

Input text


generate_input

PHP Developer Guide: generate_input Function

You can also use generate_input() method

private function generate_input($name, $value, $params, $type, $readonly, $special_folder = '')

Manual Example with generate_input

$this->generate_input(
'username',
'JohnDoe',
[
'title' => 'Username',
'add_input_class' => ['custom-class'],
'attr' => ['data-id' => '50'],
...
],
'text',
''
);

Behavior

  • Type selection: type = password renders input type password, otherwise defaults to text.
  • Readonly: Passed as an optional flag to generate a readonly field.
  • Custom attributes: Support for placeholder, title, class, id, and attr arrays.

Usage Notes

  • Use title to define label text (falls back to $this->app->language($name)).
  • Define extra classes with add_input_class.
  • Use readonly or attr['readonly'] to disable editing.
  • Ideal for editing forms.