Input Fields¶

PHPControls dedicates a separate namespace for the Form Fields. What’s common about the Form Fields is that they have either ‘input’ or ‘select’ element inside them making them perfect for using inside a atk4uiForm.

Field can also be used on it’s own like this:

'field'=>$form->model->getElement('age') ]);  The rest of this documentation chapter focuses on field visual presentation. To learn more about Forms and how it interacts with fields, go to the Forms Look and Feel¶ Similar to other views, Input has various properties that you can specify directly or inject through constructor. Those properties will affect the look of the input element. For example, icon property: Here are few ways to specify icon to an Input: // compact$page->add(new \phpctrl\ui\FormField\Line('icon'=>'search'));

// Type-hinting friendly
$line = new \phpctrl\ui\FormField\Line();$line->icon='search';
$page->add($line);

// using class factory
$page->add('FormField/Line', ['icon'=>'search']);  The ‘icon’ property can be either string or a View. The string is for convenience and will be automatically substituted with new Icon($icon). If you wish to be more specifc and pass some arguments to the icon, there are two options:

// compact
$line->icon=['search', 'big']; // Type-hinting friendly$line->icon = new Icon('search');