I want to use the EntityType to display a list of entities and allow the
user to select one.
$builder->add('icon', 'entity', array(
'class' => 'MyMainBundle:MenuIcon',
'property' => 'name',
'expanded' => true,
'multiple' => false
However, I want the output to be something like this:
<label class="radio"><input type="radio" id="..." name="..." required="
required" class="" value="1" /><img src="MY IMAGE" alt="" />MY NAME</label>
For each entity item. (MY IMAGE and MY NAME come from properties of the
So the default EntityType can handle this except for the <img...> tag.
I want to know how to extend the EntityType to still enumerate over all
entities of a given class but to expose TWO properties (or more) so that
the theme can display it as above. I haven't been able to figure it out
since the implementation for EntityType is a bit more complex than other
form Types. But I am aware of the cookbook entry on creating a new type.
Anyone know if this is possible? Should I just give up on Symfony forms and
write the code myself?
(This is Symfony 2.1.x)