Forms
Custom Resource Form
Create a FormType class for your resource
namespace App\Form\Type;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;
class BookType extends AbstractResourceType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
// Build your custom form, with all fields that you need
$builder->add('title', TextType::class);
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'app_book';
}
}Note
Register the FormType as a service
Warning
Configure the form for your resource
Last updated
Was this helpful?
