Sonata\ProductBundle\Twig\Extension\ProductExtension::getFormAddBasket PHP Method

getFormAddBasket() public method

Returns a "add to basket" form for a specified product.
public getFormAddBasket ( Sonata\Component\Product\ProductInterface $product ) : Symfony\Component\Form\FormView
$product Sonata\Component\Product\ProductInterface A product instance
return Symfony\Component\Form\FormView
    public function getFormAddBasket(ProductInterface $product)
    {
        $formBuilder = $this->formFactory->createNamedBuilder('add_basket', 'form', null, array('data_class' => $this->basketElementClass, 'csrf_protection' => false));
        $this->productPool->getProvider($product)->defineAddBasketForm($product, $formBuilder, false);
        $form = $formBuilder->getForm()->createView();
        return $form;
    }