Twig Question

Variable as name of row in TWIG : Symfony 2

I have a problem in my Symfony2 application. In Controller I'm getting an array of facebook users and posting it to my form class, where I create some checkboxes. In my template I need to print theese checkboxes as pictures of these users. I try to print it like this : {{form_row(form.{{}})}}, but TWIG template doesn't allow to use variable {{}} as name of row and also I don't know how print theese checkboxes as pictures. Can anyone help me with this ?

This is ma Controller action

public function indexAction()

$facebook = $this->get('facebook');
$friends = $facebook->api('me/friends?fields=id,name,gender');

$friends = $friends['data'];
foreach($friends as $friend){

if($friend['gender'] =='female')
for ($i=0; $i <5; $i++) {
$formular = new FriendsForm();

$form = $this->createForm($formular);

return array('girls'=>$default,'form' => $form->createView());

This is my Form class

class FriendsForm extends AbstractType
private $friends;

public function buildForm(FormBuilderInterface $builder, array $options)
$friends = $this->friends;

foreach($friends as $friend)
->add($friend['id'],'checkbox',array('label' => false,'required'=>false, 'value'=>$friend['']));


public function getName()
return '';


public function addFriend($data)
$this->friends = $data;


This is my template

{%if girls is defined%}
{%for girl in girls%}


You can use attribute built-in function (as of 1.2). says

attribute can be used to access a "dynamic" attribute of a variable

In such case you can write like below:

{{ form_row(attribute(form, }}