Files
Phraseanet/lib/Alchemy/Phrasea/Controller/Admin/PluginsController.php
2015-10-28 13:03:00 +01:00

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;
}
}