| @@ 24-53 (lines=30) @@ | ||
| 21 | * |
|
| 22 | * @author phiamo <[email protected]> |
|
| 23 | */ |
|
| 24 | class IconButtonExtension extends AbstractTypeExtension |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function getExtendedType() |
|
| 30 | { |
|
| 31 | return 'button'; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | public function configureOptions(OptionsResolver $resolver) |
|
| 38 | { |
|
| 39 | $resolver->setDefaults([ |
|
| 40 | 'vic_icon' => null, |
|
| 41 | 'vic_icon_inverted' => false, |
|
| 42 | ]); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function buildView(FormView $view, FormInterface $form, array $options) |
|
| 49 | { |
|
| 50 | $view->vars['vic_icon'] = $options['vic_icon']; |
|
| 51 | $view->vars['vic_icon_inverted'] = $options['vic_icon_inverted']; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 24-56 (lines=33) @@ | ||
| 21 | * |
|
| 22 | * @author peshi <[email protected]> |
|
| 23 | */ |
|
| 24 | class StaticTextExtension extends AbstractTypeExtension |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function getExtendedType() |
|
| 30 | { |
|
| 31 | return 'form'; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | public function configureOptions(OptionsResolver $resolver) |
|
| 38 | { |
|
| 39 | $resolver->setDefaults( |
|
| 40 | [ |
|
| 41 | 'vic_static_text' => null, |
|
| 42 | ] |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function buildView(FormView $view, FormInterface $form, array $options) |
|
| 50 | { |
|
| 51 | $view->vars['vic_static_text'] = $options['vic_static_text']; |
|
| 52 | if ($options['vic_static_text'] == true) { |
|
| 53 | $view->vars['disabled'] = true; |
|
| 54 | } |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||