use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class UrlType extends AbstractType
{ /**
* @return void
*/
public function buildForm(FormBuilderInterface
$builder, array
$options) { if (null !==
$options['default_protocol'
]) { $builder->
addEventSubscriber(new FixUrlProtocolListener($options['default_protocol'
]));
} } /**
* @return void
*/
public function buildView(FormView
$view, FormInterface
$form, array
$options) { if ($options['default_protocol'
]) { $view->vars
['attr'
]['inputmode'
] = 'url';
$view->vars
['type'
] = 'text';
}