public function browserAction()
    {
        if (false === $this->admin->isGranted('LIST')) {
            throw new AccessDeniedException();
        }

        $datagrid = $this->admin->getDatagrid();
        $datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));
        $datagrid->setValue('providerName', null, $this->admin->getPersistentParameter('provider'));

        // Store formats
        $formats = array();
        foreach ($datagrid->getResults() as $media) {
            $formats[$media->getId()] = $this->get('sonata.media.pool')->getFormatNamesByContext($media->getContext());
        }

        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->setFormTheme($formView, $this->admin->getFilterTheme());

        return $this->render($this->getTemplate('browser'), array(
            'action' => 'browser',
            'form' => $formView,
            'datagrid' => $datagrid,
            'formats' => $formats,
            'base_template' => $this->getTemplate('layout'),
        ));
    }
public function browserAction()
    {
        if (false === $this->admin->isGranted('LIST')) {
            throw new AccessDeniedException();
        }

        $datagrid = $this->admin->getDatagrid();
        $datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));
        $datagrid->setValue('providerName', null, $this->admin->getPersistentParameter('provider'));

        // Store formats
        $formats = array();
        foreach ($datagrid->getResults() as $media) {
            $formats[$media->getId()] = $this->get('sonata.media.pool')->getFormatNamesByContext($media->getContext());
        }

        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->setFormTheme($formView, $this->admin->getFilterTheme());

        return $this->render($this->getTemplate('browser'), array(
            'action' => 'browser',
            'form' => $formView,
            'datagrid' => $datagrid,
            'formats' => $formats,
            'base_template' => $this->getTemplate('layout'),
        ));
    }
public function browserAction ( ) { if ( false === $ this -> admin -> isGranted ( 'LIST' ) ) { throw new AccessDeniedException ( ) ; } $ datagrid = $ this -> admin -> getDatagrid ( ) ; $ datagrid -> setValue ( 'context' , null , $ this -> admin -> getPersistentParameter ( 'context' ) ) ; $ datagrid -> setValue ( 'providerName' , null , $ this -> admin -> getPersistentParameter ( 'provider' ) ) ; // Store formats $ formats = array ( ) ; foreach ( $ datagrid -> getResults ( ) as $ media ) { $ formats [ $ media -> getId ( ) ] = $ this -> get ( 'sonata.media.pool' ) -> getFormatNamesByContext ( $ media -> getContext ( ) ) ; } $ formView = $ datagrid -> getForm ( ) -> createView ( ) ; // set the theme for the current Admin Form $ this -> setFormTheme ( $ formView , $ this -> admin -> getFilterTheme ( ) ) ; return $ this -> render ( $ this -> getTemplate ( 'browser' ) , array ( 'action' => 'browser' , 'form' => $ formView , 'datagrid' => $ datagrid , 'formats' => $ formats , 'base_template' => $ this -> getTemplate ( 'layout' ) , ) ) ; }
Returns the response object associated with the browser action.

@return Response

@throws AccessDeniedException
Returns the response object associated with the browser action .