Perform the show action for a block

@param ReadBlockInterface $block

@return Response
349397
public function show(ReadBlockInterface $block)
    {
        $parameters = array(
            'pubid' => $block->getAttribute('pubid'),
            'class' => $block->getStyle(),
            'id' => $block->getId(),
            'addThisClass' => $block->getAttribute('addThisClass'),
        );

        return $this->render('OpenOrchestraDisplayBundle:Block/AddThis:show.html.twig', $parameters);
    }
1303025
public function update(Model\BlockInterface $block, Request $request)
    {
        // Plugin update
        return $this->editor
            ->getBlockPlugin($block->getType())
            ->update($block, $request);
    }
23280
protected function _filterBlock(Block $block)
    {
        $cacheKey = "allowed_{$block->id}";
        $cache = static::cache($cacheKey);

        if ($cache !== null) {
            return $cache;
        }

        if (!empty($block->locale) &&
            !in_array(I18n::locale(), (array)$block->locale)
        ) {
            return static::cache($cacheKey, false);
        }

        if (!$block->isAccessibleByUser()) {
            return static::cache($cacheKey, false);
        }

        $allowed = false;
        switch ($block->visibility) {
            case 'except':
                // Show on all pages except listed pages
                $allowed = !$this->_urlMatch($block->pages);
                break;
            case 'only':
                // Show only on listed pages
                $allowed = $this->_urlMatch($block->pages);
                break;
            case 'php':
                // Use custom PHP code to determine visibility
                $allowed = php_eval($block->pages, [
                    'view' => &$this->_View,
                    'block' => &$block
                ]) === true;
                break;
        }

        if (!$allowed) {
            return static::cache($cacheKey, false);
        }

        return static::cache($cacheKey, true);
    }
70984
public function show(ReadBlockInterface $block)
    {
        $request = $this->requestStack->getCurrentRequest();

        $data = $request->get('elastica_search');
        $searchData = array();
        if (is_array($data) && array_key_exists('search', $data) && null !== $data['search']) {
            $searchParameter = $data['search'];

            $index = $this->client->getIndex($this->indexName);

            $qb = new QueryBuilder();

            $search = new Search($this->client);
            $search->addIndex($index);
            $search->setQuery($qb->query()->filtered(
                $qb->query()->query_string($searchParameter),
                $qb->filter()->bool()->addMust(
                    $qb->filter()->term(array('language' => $request->getLocale()))
                )
            ));
            $searchData = $search->search(null, array('limit' => $block->getAttribute('searchLimit')));
        }

        return $this->render('OpenOrchestraElasticaFrontBundle:Block/List:show.html.twig', array(
            'searchData' => $searchData,
            'id' => $block->getId(),
            'class' => $block->getStyle(),
        ));
    }
481597
public function edit(BlockRequest $request, Block $block)
    {
        return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('block::block.name'))
            ->view('block::admin.block.edit')
            ->data(compact('block'))
            ->output();
    }
544038
public function getBlockParameter(ReadBlockInterface $block)
    {
        $strategy = $this->getStrategy($block);
        if (null === $strategy) {
            throw new DisplayBlockStrategyNotFoundException($block->getComponent());
        }

        return $strategy->getBlockParameter();
    }
987453
public function renderBlock(BlockInterface $block, $arguments = array())
    {
        /** @var BlockManager $manager */
        $manager = $this->container->get('opifer.content.block_manager');

        $service = $manager->getService($block);

        if ($this->blockEnvironment->getBlockMode($block) == 'manage') {
            $content =  $service->setEnvironment($this->blockEnvironment)->manage($block)->getContent();
//            $block->isRendered = true;
//
//            // TODO check for unrendered blocks
//            if ($block instanceof BlockContainerInterface) {
//                foreach ($block->getChildren() as $child) {
//                    if (!property_exists($child, 'isRendered') || $child->isRendered) {
//                        $content .= $manager->getService($child)->manage($child)->getContent();
//                    }
//                }
//            }

            return $content;
        }

        return $service->execute($block)->getContent();
    }
592639
protected function getNodes(ReadBlockInterface $block)
    {
        $nodes = null;
        $nodeName = $block->getAttribute('nodeName');
        $siteId = $this->currentSiteManager->getSiteId();

        if (!is_null($nodeName)) {
            $nodes = $this->nodeRepository->getSubMenu($nodeName, $block->getAttribute('nbLevel'), $this->request->getLocale(), $siteId);
            $nodes = $this->getGrantedNodes($nodes);
        }

        return $nodes;
    }
447897
public function show(ReadBlockInterface $block)
    {
        $parameters = $this->getParameters();

        $currentPage = $this->request->get(NavigatorExtension::PARAMETER_PAGE);
        if (!$currentPage) {
            $currentPage = 1;
        }

        return $this->render(
            $this->template,
            array(
                'galleryClass' => $block->getStyle(),
                'id' => $block->getId(),
                'pictures' => $this->filterMedias($block->getAttribute('pictures'), $currentPage, $block->getAttribute('itemNumber')),
                'numberOfColumns' => $block->getAttribute('columnNumber'),
                'thumbnailFormat' => $block->getAttribute('thumbnailFormat'),
                'imageFormat' => $block->getAttribute('imageFormat'),
                'numberOfPages' => ($block->getAttribute('itemNumber') == 0) ? 1 : ceil(count($block->getAttribute('pictures')) / $block->getAttribute('itemNumber')),
                'parameters' => $parameters,
                'currentPage' => $currentPage,
                'width' => $block->getAttribute('width'),
            )
        );
    }
1042154
public function show($id, $translationId)
    {
        $block = $this->getBlock($id);
        if (!empty($block)) {
            $this->authorize('read', $block);
            $translation = $this->repository->getBlockTranslationById($block, $translationId);
            if (!empty($translation)) {
                return $this->respondWithSuccess($translation, new BlockTranslationTransformer);
            }
        }
        return $this->respondNotFound();
    }
1344979
public function moveRight(Model\BlockInterface $block)
    {
        $sibling = $this->editor->getRepository()->findSiblingBlock($block, true);
        if (null === $sibling) {
            throw new InvalidOperationException(
                "The block can't be moved to the right as no sibling block has been found."
            );
        }

        $block->setPosition($block->getPosition() + 1);
        $sibling->setPosition($sibling->getPosition() - 1);

        $this->sortChildrenByPosition($block->getRow(), 'blocks');

        return $sibling;
    }
1344230
public function show(ReadBlockInterface $block)
    {
        $parameters = $this->requestStack->getMasterRequest()->get('_route_params');
        if (!array_key_exists('siteId', $parameters) || !array_key_exists('nodeId', $parameters)) {
            throw new RouteNotFoundException();
        }
        $site = $this->siteRepository->findOneBySiteId($parameters['siteId']);
        $routes = array();
        if (!\is_null($site)) {
            foreach ($site->getLanguages() as $language) {
                try {
                    unset($parameters['_locale']);
                    unset($parameters['aliasId']);

                    $routes[$language] = $this->urlGenerator->generate($parameters['nodeId'], array_merge(
                        $parameters,
                        array(OpenOrchestraDatabaseUrlGenerator::REDIRECT_TO_LANGUAGE => $language)
                    ));
                } catch (ResourceNotFoundException $e) {
                } catch (RouteNotFoundException $e) {
                } catch (MissingMandatoryParametersException $e) {
                }
            }
        }

        return $this->render(
            $this->template,
            array(
                'class' => $block->getStyle(),
                'id' => $block->getId(),
                'routes' => $routes,
            )
        );
    }
304696
public function show(ReadBlockInterface $block)
    {
        return $this->render(
            'OpenOrchestraDisplayBundle:Block/AudienceAnalysis:' . $block->getAttribute('tag_type') . '.html.twig',
            array(
                'attributes' => $block->getAttributes(),
                'page' => $this->requestStack->getCurrentRequest()->attributes->get('nodeId')
            )
        );
    }
125804
public function execute(BlockInterface $block, Response $response = null, array $parameters = [])
    {
        $collection = $this->contentManager->getRepository()->findOrderedByIds(json_decode($block->getValue()));

        if ($collection) {
            $block->setCollection($collection);
        }

        return parent::execute($block, $response, $parameters);
    }
10216
protected function getStrategy(ReadBlockInterface $block)
    {
        if (isset($this->cachedStrategies[$block->getId()])) {
            return $this->cachedStrategies[$block->getId()];
        }

        foreach ($this->strategies as $strategy) {
            if ($strategy->support($block)) {
                if ($block->getId()) {
                    $this->cachedStrategies[$block->getId()] = $strategy;
                }

                return $strategy;
            }
        }

        return null;
    }
98308
public function start($block)
    {
        if ($this->enabled) {
            if (!isset($this->blocks[$block])) {
                $this->blocks[$block] = array();
            }

            $this->blocks[$block]['start'] = microtime(true);
            $this->blocks[$block]['start-line'] = $this->getLineNumber();
        }
    }
1236273
public function show(ReadBlockInterface $block)
    {
        $currentRequest = $this->requestStack->getCurrentRequest();

        $routeAttributes = array_merge(
            $currentRequest->get('_route_params'),
            array(
                'previous' => $currentRequest->get('currentRouteName'),
                'aliasId'  => $currentRequest->get('aliasId'),
            )
        );

        $form = $this->formFactory->create(
            ContactType::class,
            null,
            array(
                'method' => 'POST',
                'action' => $this->urlGenerator->generate(
                    'open_orchestra_front_block',
                    $routeAttributes
                )
            )
        );

        $form->handleRequest($currentRequest);

        if ($form->isValid()) {
            $recipient = $block->getAttribute("recipient");
            $signature = $block->getAttribute("signature");
            $formData = $form->getData();
            //send alert message to webmaster
            $messageToAdmin = \Swift_Message::newInstance()
                ->setSubject($formData['subject'])
                ->setFrom($formData['email'])
                ->setTo($recipient)
                ->setBody(
                    $this->renderView(
                        'OpenOrchestraDisplayBundle:Block/Email:show_admin.txt.twig',
                        array(
                            'name' => $formData['name'],
                            'message' => $formData['message'],
                            'mail' => $formData['email'],
                        )
                    )
                );
            $event = new MailerEvent($messageToAdmin);
            $this->dispatcher->dispatch(MailerEvents::SEND_MAIL, $event);

            //send confirm e-mail for the user
            $messageToUser = \Swift_Message::newInstance()
                ->setSubject('open_orchestra_display.contact.contact_received')
                ->setFrom($recipient)
                ->setTo($formData['email'])
                ->setBody(
                    $this->renderView(
                        'OpenOrchestraDisplayBundle:Block/Email:show_user.txt.twig',
                        array('signature' => $signature)
                    )
                );
            $event = new MailerEvent($messageToUser);
            $this->dispatcher->dispatch(MailerEvents::SEND_MAIL, $event);
        }

        return $this->render('OpenOrchestraDisplayBundle:Block/Contact:show.html.twig', array(
            'form' => $form->createView(),
            'id' => $block->getId(),
            'class' => $block->getStyle(),
        ));
    }