|
4 | 4 |
|
5 | 5 | namespace AdamWojs\IbexaFormattedTextLineBundle\Form\Mapper\FormattedTextLine; |
6 | 6 |
|
7 | | -use AdamWojs\IbexaFormattedTextLineBundle\Form\Type\TextLineFieldType; |
| 7 | +use AdamWojs\IbexaFormattedTextLineBundle\FieldType\FormattedTextLine\Format; |
| 8 | +use AdamWojs\IbexaFormattedTextLineBundle\Form\Type\FormattedTextLineFieldType; |
8 | 9 | use EzSystems\EzPlatformContentForms\Data\Content\FieldData; |
9 | 10 | use EzSystems\EzPlatformContentForms\FieldType\FieldValueFormMapperInterface; |
10 | 11 | use Symfony\Component\Form\FormInterface; |
11 | 12 |
|
12 | | -final class FieldValueFormMapper implements FieldValueFormMapperInterface |
| 13 | +class FieldValueFormMapper implements FieldValueFormMapperInterface |
13 | 14 | { |
| 15 | + /** @var \AdamWojs\IbexaFormattedTextLineBundle\FieldType\FormattedTextLine\Format */ |
| 16 | + private $format; |
| 17 | + |
| 18 | + public function __construct(Format $format) |
| 19 | + { |
| 20 | + $this->format = $format; |
| 21 | + } |
| 22 | + |
14 | 23 | public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void |
15 | 24 | { |
16 | 25 | $definition = $data->fieldDefinition; |
17 | 26 |
|
18 | | - $fieldForm->add('value', TextLineFieldType::class, [ |
19 | | - 'required' => $definition->isRequired, |
20 | | - 'label' => $definition->getName(), |
21 | | - ]); |
| 27 | + $fieldForm->add( |
| 28 | + 'value', |
| 29 | + FormattedTextLineFieldType::class, |
| 30 | + [ |
| 31 | + 'required' => $definition->isRequired, |
| 32 | + 'label' => $definition->getName(), |
| 33 | + 'mask' => $this->format->getMask($definition), |
| 34 | + 'examples' => $this->format->getExamples($definition), |
| 35 | + ] |
| 36 | + ); |
22 | 37 | } |
23 | 38 | } |
0 commit comments