Closed delyriand closed 1 year ago
Define your options in the yaml file :
monsieurbiz_sylius_richeditor: ui_elements: app.image: classes: form: App\Form\Type\UiElement\ImageType form_options: image_width: '700px' image_height: '700px'
Create your ui element form with the custom (or not) options:
class ImageType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $imageHelpMessage = 'app.ui.help_image_width_max'; $imageHelpTranslationParameters = [ '%width%' => $options['image_width'], ]; if (isset($options['image-height'])) { $imageHelpMessage = 'app.ui.help_image'; $imageHelpTranslationParameters['%height%'] = $options['image-height']; } // ... } public function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); $resolver->setRequired(['image_width']); $resolver->setDefined(['image_height']); $resolver->setAllowedTypes('image_width', 'string'); $resolver->setAllowedTypes('image_height', 'string'); } }
Example
Define your options in the yaml file :
Create your ui element form with the custom (or not) options: