I want to send a part of HTML as a variable inside the array params in $this->render() function.
I use this variable in my view, {{ other_product | raw }} but it doesn't format the TWIG syntax as well and get the correct path.
public function productsAction(){
$em = $this->getDoctrine()->getManager();
$produits = $em->getRepository('AppBundle:Products')->findBy(array('disponibility' => 1));
$other_product='<a href="{{ path(similar_product) }}" target="_blank">Other product</a>';
return $this->render('AppBundle:Default:products/layout/products.html.twig', array(
'products' => $products,
'other_product' => $other_product)
);
}
This is the result
<a href="{{ path(similar_product) }}" target="_blank">Other product</a>
How to format or filter this variable ?