These are types that are used most of the time in forms. All fields that match this pattern are in this category:

<input type="TYPE_HERE">

Here’s the full list:

  • text
  • email
  • password
  • hidden
  • textarea
  • number
  • file
  • image
  • url
  • tel
  • search
  • color
  • date
  • datetime-local
  • month
  • range
  • time
  • week

Beside inherited options, it contains option that is used to set value for the field:

<?php
$this->add('name', 'text', [
    'value' => 'John'
]);

value (String) (Default: null) - Used for setting default value.

If not provided, Form class will search for name property on the passed model.

In case you want to modify the value pulled from model before it’s passed to view, you can use Closure to manipulate data:

<?php
$this->add('name', 'text', [
    'value' => function ($name) {
        return 'This is name: ' + $name;
    }
]);