-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormTypeExtension.php
More file actions
35 lines (30 loc) · 957 Bytes
/
FormTypeExtension.php
File metadata and controls
35 lines (30 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Msvdev\Bitrix\Forms;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Class FormTypeExtension
* @package Wn\Symfony\Forms
* Расширение для добавления help сообщения
* @see https://stackoverflow.com/questions/39944874/adding-help-option-to-symfony3-all-formtypes
*/
class FormTypeExtension extends AbstractTypeExtension
{
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['help'] = $options['help'];
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'help' => null,
));
}
public function getExtendedType()
{
return FormType::class;
}
}