mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2015 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
namespace Alchemy\Phrasea\Controller\Admin;
|
|
|
|
use Alchemy\Phrasea\Application;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
|
|
|
class PluginsController
|
|
{
|
|
/** @var Application */
|
|
private $app;
|
|
|
|
public function __construct(Application $app)
|
|
{
|
|
$this->app = $app;
|
|
}
|
|
|
|
public function indexAction()
|
|
{
|
|
return $this->render('admin/plugins/index.html.twig', [
|
|
'plugins' => $this->app['plugins'],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @param string $view
|
|
* @param array $parameters
|
|
* @param Response|null $response
|
|
* @return Response
|
|
*/
|
|
public function render($view, array $parameters = array(), Response $response = null)
|
|
{
|
|
/** @var \Twig_Environment $twig */
|
|
$twig = $this->app['twig'];
|
|
|
|
if ($response instanceof StreamedResponse) {
|
|
$response->setCallback(function () use ($twig, $view, $parameters) {
|
|
$twig->display($view, $parameters);
|
|
});
|
|
} else {
|
|
if (null === $response) {
|
|
$response = new Response();
|
|
}
|
|
$response->setContent($twig->render($view, $parameters));
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|