public function renderMediaThumb(MediaInterface $media = null, array $controls = array())
    {
        if (null !== $media) {
            $media->setThumb($this->thumbGenerator->generateThumbUrl($media));
        }
        /*if (empty($controls)) {
            $controls = array(
                array('role' => 'edit',     'icon' => 'pencil'),
                //array('role' => 'delete',   'icon' => 'trash'),
                array('role' => 'download', 'icon' => 'download'),
            );
        }*/
        foreach ($controls as $control) {
            if (!(array_key_exists('role', $control) && array_key_exists('icon', $control))) {
                throw new \InvalidArgumentException('Controls must have "role" and "icon" defined.');
            }
        }

        $data = '{}';
        if ($media) {
            $context = SerializationContext::create()->setGroups(array('Manager'));
            $data = $this->serializer->serialize($media, 'json', $context);
        }

        return $this->thumbTemplate->render(array(
            'media'    => $media,
            'data'     => $data,
            'controls' => $controls,
            'selector' => false,
        ));
    }
public function renderMediaThumb(MediaInterface $media = null, array $controls = array())
    {
        if (null !== $media) {
            $media->setThumb($this->thumbGenerator->generateThumbUrl($media));
        }
        /*if (empty($controls)) {
            $controls = array(
                array('role' => 'edit',     'icon' => 'pencil'),
                //array('role' => 'delete',   'icon' => 'trash'),
                array('role' => 'download', 'icon' => 'download'),
            );
        }*/
        foreach ($controls as $control) {
            if (!(array_key_exists('role', $control) && array_key_exists('icon', $control))) {
                throw new \InvalidArgumentException('Controls must have "role" and "icon" defined.');
            }
        }

        $data = '{}';
        if ($media) {
            $context = SerializationContext::create()->setGroups(array('Manager'));
            $data = $this->serializer->serialize($media, 'json', $context);
        }

        return $this->thumbTemplate->render(array(
            'media'    => $media,
            'data'     => $data,
            'controls' => $controls,
            'selector' => false,
        ));
    }
public function renderMediaThumb ( MediaInterface $ media = null , array $ controls = array ( ) ) { if ( null !== $ media ) { $ media -> setThumb ( $ this -> thumbGenerator -> generateThumbUrl ( $ media ) ) ; } /*if (empty($controls)) {
            $controls = array(
                array('role' => 'edit',     'icon' => 'pencil'),
                //array('role' => 'delete',   'icon' => 'trash'),
                array('role' => 'download', 'icon' => 'download'),
            );
        }*/ foreach ( $ controls as $ control ) { if ( ! ( array_key_exists ( 'role' , $ control ) && array_key_exists ( 'icon' , $ control ) ) ) { throw new \ InvalidArgumentException ( 'Controls must have "role" and "icon" defined.' ) ; } } $ data = '{}' ; if ( $ media ) { $ context = SerializationContext :: create ( ) -> setGroups ( array ( 'Manager' ) ) ; $ data = $ this -> serializer -> serialize ( $ media , 'json' , $ context ) ; } return $ this -> thumbTemplate -> render ( array ( 'media' => $ media , 'data' => $ data , 'controls' => $ controls , 'selector' => false , ) ) ; }
Renders the media thumb.

@param MediaInterface $media
@param array          $controls
@return string
Renders the media thumb .