mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Add basic template and hooks in Admin
This commit is contained in:
57
lib/Alchemy/Phrasea/Controller/Admin/PluginsController.php
Normal file
57
lib/Alchemy/Phrasea/Controller/Admin/PluginsController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user