Restrict sonata_type_model_list to 1 context

408 views Asked by At

I am trying to allow users to select from existing images in the system and have context set like the provided example and this works. How can I stop the users from selecting from any other context type?

$form->add('image', 'sonata_type_model_list', array(), array('link_parameters' => array('context' => 'news')))
1

There are 1 answers

1
Marc Juchli On

Not tested but I just stumbled over the parameter: hide_context

$form->add('image', 'sonata_type_model_list', array(), array(
    'link_parameters' => array(
        'context' => 'news', 
        'hide_context' => true
     )
 ))

Maybe you want to give it a try?