Create event theme admin entity

This commit is contained in:
2025-04-28 16:32:48 +02:00
parent c0826bc65c
commit e594b65d1e
15 changed files with 608 additions and 7 deletions

View File

@@ -11,6 +11,9 @@ declare(strict_types=1);
namespace Chill\EventBundle\DependencyInjection;
use Chill\EventBundle\Controller\EventThemeController;
use Chill\EventBundle\Entity\EventTheme;
use Chill\EventBundle\Form\EventThemeType;
use Chill\EventBundle\Security\EventVoter;
use Chill\EventBundle\Security\ParticipationVoter;
use Symfony\Component\Config\FileLocator;
@@ -26,7 +29,10 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/
class ChillEventExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container)
/**
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
@@ -45,16 +51,17 @@ class ChillEventExtension extends Extension implements PrependExtensionInterface
/** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prepend(ContainerBuilder $container)
public function prepend(ContainerBuilder $container): void
{
$this->prependAuthorization($container);
$this->prependCruds($container);
$this->prependRoute($container);
}
/**
* add authorization hierarchy.
*/
protected function prependAuthorization(ContainerBuilder $container)
protected function prependAuthorization(ContainerBuilder $container): void
{
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
@@ -70,7 +77,7 @@ class ChillEventExtension extends Extension implements PrependExtensionInterface
/**
* add route to route loader for chill.
*/
protected function prependRoute(ContainerBuilder $container)
protected function prependRoute(ContainerBuilder $container): void
{
// add routes for custom bundle
$container->prependExtensionConfig('chill_main', [
@@ -81,4 +88,33 @@ class ChillEventExtension extends Extension implements PrependExtensionInterface
],
]);
}
protected function prependCruds(ContainerBuilder $container): void
{
$container->prependExtensionConfig('chill_main', [
'cruds' => [
[
'class' => EventTheme::class,
'name' => 'event_theme',
'base_path' => '/admin/event/theme',
'form_class' => EventThemeType::class,
'controller' => EventThemeController::class,
'actions' => [
'index' => [
'template' => '@ChillEvent/Admin/EventTheme/index.html.twig',
'role' => 'ROLE_ADMIN',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillEvent/Admin/EventTheme/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillEvent/Admin/EventTheme/edit.html.twig',
],
],
],
],
]);
}
}