X-Git-Url: https://git.rapsys.eu/treebundle/blobdiff_plain/24d9ae0ef4b68b275bfcc3da3fccb0300ebab323..17bf62df138ce9e4d6c86e7e523f467cb109888c:/Controller/TreeController.php?ds=sidebyside diff --git a/Controller/TreeController.php b/Controller/TreeController.php index b51c01d..53bd429 100644 --- a/Controller/TreeController.php +++ b/Controller/TreeController.php @@ -11,15 +11,60 @@ namespace Rapsys\TreeBundle\Controller; +use Psr\Container\ContainerInterface; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +use Twig\Environment; /** * {@inheritdoc} */ class TreeController extends AbstractController { + /** + * Context array + */ + protected array $context = []; + /** * Creates a new tree controller + * + * @param ContainerInterface $container The ContainerInterface instance + * @param Environment $twig The twig environment instance + */ + function __construct(protected ContainerInterface $container, protected Environment $twig) { + } + + /** + * The index page + * + * Display file tree + * + * @param Request $request The request instance + * @return Response The rendered view */ - function __construct() { + public function index(Request $request, string $path): Response { + //Set title + $this->context['title'] = [ + 'page' => 'Page title', + 'section' => 'Section title', + 'site' => 'Site title' + ]; + + //Set canonical + $this->context['canonical'] = ''; + + //Render template + $response = $this->twig->render('@RapsysTree/index.html.twig', $this->context); + var_dump($response); + exit; + $response->setEtag(md5($response->getContent())); + $response->setPublic(); + $response->isNotModified($request); + + //Return response + return $response; } }