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