| Total Complexity | 3 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class textareaExtension extends AbstractTypeExtension |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | 108 | public function configureOptions(OptionsResolver $resolver) |
|
| 24 | { |
||
| 25 | 1 | $map_attr = function (Options $options, $value) { |
|
| 26 | 108 | $value ??= []; |
|
| 27 | 108 | $value['rows'] = $options['widget_config']['height']; |
|
| 28 | 108 | $value['cols'] = $options['widget_config']['width']; |
|
| 29 | |||
| 30 | 108 | return $value; |
|
| 31 | 1 | }; |
|
| 32 | 1 | $resolver->setDefault('attr', $map_attr); |
|
| 33 | |||
| 34 | 1 | helper::add_normalizers($resolver, [ |
|
| 35 | 1 | 'widget_config' => [ |
|
| 36 | 1 | 'height' => 6, |
|
| 37 | 1 | 'width' => 50 |
|
| 38 | 1 | ], |
|
| 39 | 1 | 'type_config' => [ |
|
| 40 | 1 | 'output_mode' => 'html', |
|
| 41 | 1 | 'specialchars_quotes' => ENT_QUOTES, |
|
| 42 | 1 | 'specialchars_charset' => 'UTF-8', |
|
| 43 | 1 | 'forbidden_patterns' => [], |
|
| 44 | 1 | 'maxlength' => 0, |
|
| 45 | 1 | 'purify' => false, |
|
| 46 | 1 | 'purify_config' => [] |
|
| 47 | 1 | ] |
|
| 48 | 1 | ]); |
|
| 49 | } |
||
| 50 | |||
| 51 | 107 | public function finishView(FormView $view, FormInterface $form, array $options) |
|
| 52 | { |
||
| 53 | 107 | $view->vars['output_mode'] = $options['type_config']['output_mode']; |
|
| 54 | } |
||
| 55 | |||
| 56 | 1 | public static function getExtendedTypes() : iterable |
|
| 59 | } |
||
| 60 | } |
||
| 61 |