public function viewBlock(Block $block, array $params = array(), array $cacheSettings = array())
    {
        $response = new Response();
        if ($this->getParameter('content.view_cache') === true) {
            $response->setPublic();
            if (
                isset($cacheSettings['smax-age'])
                && is_int($cacheSettings['smax-age'])
            ) {
                $response->setSharedMaxAge((int)$cacheSettings['smax-age']);
            }
            if (
                isset($cacheSettings['max-age'])
                && is_int($cacheSettings['max-age'])
            ) {
                $response->setMaxAge((int)$cacheSettings['max-age']);
            }
        }

        $response->setContent(
            $this->viewManager->renderBlock(
                $block,
                $params + array(
                    // @deprecated pageService injection will be removed in 6.0.
                    'pageService' => $this->pageService,
                    'valid_items' => $this->pageService->getValidBlockItems($block),
                )
            )
        );

        return $response;
    }
public function viewBlock(Block $block, array $params = array(), array $cacheSettings = array())
    {
        $response = new Response();
        if ($this->getParameter('content.view_cache') === true) {
            $response->setPublic();
            if (
                isset($cacheSettings['smax-age'])
                && is_int($cacheSettings['smax-age'])
            ) {
                $response->setSharedMaxAge((int)$cacheSettings['smax-age']);
            }
            if (
                isset($cacheSettings['max-age'])
                && is_int($cacheSettings['max-age'])
            ) {
                $response->setMaxAge((int)$cacheSettings['max-age']);
            }
        }

        $response->setContent(
            $this->viewManager->renderBlock(
                $block,
                $params + array(
                    // @deprecated pageService injection will be removed in 6.0.
                    'pageService' => $this->pageService,
                    'valid_items' => $this->pageService->getValidBlockItems($block),
                )
            )
        );

        return $response;
    }
public function viewBlock ( Block $ block , array $ params = array ( ) , array $ cacheSettings = array ( ) ) { $ response = new Response ( ) ; if ( $ this -> getParameter ( 'content.view_cache' ) === true ) { $ response -> setPublic ( ) ; if ( isset ( $ cacheSettings [ 'smax-age' ] ) && is_int ( $ cacheSettings [ 'smax-age' ] ) ) { $ response -> setSharedMaxAge ( ( int ) $ cacheSettings [ 'smax-age' ] ) ; } if ( isset ( $ cacheSettings [ 'max-age' ] ) && is_int ( $ cacheSettings [ 'max-age' ] ) ) { $ response -> setMaxAge ( ( int ) $ cacheSettings [ 'max-age' ] ) ; } } $ response -> setContent ( $ this -> viewManager -> renderBlock ( $ block , $ params + array ( // @deprecated pageService injection will be removed in 6.0. 'pageService' => $ this -> pageService , 'valid_items' => $ this -> pageService -> getValidBlockItems ( $ block ) , ) ) ) ; return $ response ; }
Render the block.

@param \eZ\Publish\Core\FieldType\Page\Parts\Block $block
@param array $params
@param array $cacheSettings settings for the HTTP cache, 'smax-age' and
'max-age' are checked.

@return \Symfony\Component\HttpFoundation\Response
Render the block .