src/Controller/Website/BlockController.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Website;
  3. use App\Utils\SchemaManager;
  4. use Sulu\Component\Content\Compat\StructureInterface;
  5. use Symfony\Component\HttpFoundation\RedirectResponse;
  6. use Symfony\Component\HttpFoundation\Response;
  7. class BlockController extends SuluExtendController
  8. {
  9.     public function viewAction(
  10.         StructureInterface       $structure,
  11.         SchemaManager            $schemaManager,
  12.                                  $attributes = [],
  13.                                  $preview false,
  14.                                  $partial false,
  15.     ): Response
  16.     {
  17.         $attributes $this->getAttributes([], $structure);
  18.         $attributes['breadcrumbs'] = $this->getBreadcrumbs('page'$attributes['uuid']);
  19.         $schema $schemaManager->getDefaultSchemas$attributes['breadcrumbs']);
  20.         if(isset($attributes['content']['blocks'])) {
  21.             $blockList $this->resolveBlocks($attributes['content']['blocks'], $schema);
  22.             if($blockList instanceof RedirectResponse) {
  23.                 return $blockList;
  24.             }
  25.             $attributes['content']['blocks'] = $blockList->getBlocks();
  26.             $schema $blockList->getSchema();
  27.         }
  28.         $attributes['_schema'] = implode(''$schema);
  29.         return $this->renderAll('pages/blocks.html.twig'$attributes$preview$partial);
  30.     }
  31. }