S
S
symnoob2020-12-08 18:33:52
symfony
symnoob, 2020-12-08 18:33:52

Symfony - How to reshape a Bundle?

Hello everyone, how can I change the Bundle Form, or rather, remove an unnecessary text field from there?
And the Form is rendered in the bundle itself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2020-12-09
@symnoob

You can use the Form Type Extension

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;

class BundleFormTypeExtension extends AbstractTypeExtension
{
    public static function getExtendedTypes(): iterable
    {
        return [BundleFormType::class];
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->remove('someField');
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question