2021-03-20 13:40:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Core\Controller\Admin;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
2021-03-24 12:05:45 +01:00
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
2021-03-20 13:40:38 +01:00
|
|
|
|
|
|
|
abstract class AdminController extends AbstractController
|
|
|
|
{
|
2021-03-24 12:05:45 +01:00
|
|
|
protected array $coreParameters;
|
|
|
|
|
|
|
|
public function __construct(ParameterBagInterface $parameters)
|
|
|
|
{
|
|
|
|
$this->coreParameters = $parameters->get('core');
|
|
|
|
}
|
|
|
|
|
2021-03-20 13:40:38 +01:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
protected function render(string $view, array $parameters = [], Response $response = null): Response
|
|
|
|
{
|
|
|
|
$parameters['section'] = $this->getSection();
|
2021-03-24 12:05:45 +01:00
|
|
|
$parameters['site_name'] = $this->coreParameters['site']['name'];
|
|
|
|
$parameters['site_logo'] = $this->coreParameters['site']['logo'];
|
2021-03-20 13:40:38 +01:00
|
|
|
|
|
|
|
return parent::render($view, $parameters, $response);
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract protected function getSection(): string;
|
|
|
|
}
|