cedriclombardot/admingenerator-oldtheme-bundle
Installation
Add the bundle to your composer.json:
composer require cedriclombardot/admingenerator-oldtheme-bundle
Register the bundle in config/bundles.php (Symfony 4+):
return [
// ...
CedricLombardot\AdminGeneratorOldThemeBundle\CedricLombardotAdminGeneratorOldThemeBundle::class => ['all' => true],
];
Configuration
Ensure admingenerator is configured in config/packages/admingenerator.yaml:
admingenerator:
theme: old # Explicitly set to use the old theme
First Use Case
Generate a CRUD for an existing entity (e.g., User):
php bin/console admingenerator:generate --dest=src --theme=old --model=App\Entity\User
Navigate to /admin to see the legacy-style admin interface.
Legacy Admin Migration
UserAdmin class with the old theme, then incrementally update templates/views.Hybrid Theming
# config/routes.yaml
admin_old:
resource: "@AdminGeneratorOldThemeBundle/Resources/config/routing.yml"
prefix: /admin/legacy
Customization
templates/admin/ (e.g., base.html.twig).AdminGeneratorOldThemeBundle by creating a custom theme bundle inheriting from it.Entity-Specific Themes
--theme=old flag per generation:
php bin/console admingenerator:generate --model=App\Entity/Product --theme=old
AdminGeneratorOldThemeBundle:Form:fields.html.twig for consistent styling.public/bundles/admingeneratoroldtheme/ to align with your app’s design.@IsGranted("ROLE_ADMIN")) alongside the old theme’s access controls.Deprecation Warnings
Template Overrides
templates/admin/AdmingeneratorOldThemeBundle/
php bin/console cache:clear
Routing Conflicts
/admin. Conflict with other bundles (e.g., EasyAdmin) by:
admingenerator:
generate_routes: false
Entity Generation Quirks
--no-form flag for complex relations:
php bin/console admingenerator:generate --model=App\Entity/Order --no-form
config/packages/dev/debug.yaml:
framework:
templating:
engines: ['twig']
php bin/console admingenerator:generate -v
Custom Fields
AdminGeneratorOldThemeBundle:Form:fields.html.twig or creating a custom field type class.Action Overrides
edit, delete) in src/Admin/YourAdmin.php:
protected function configureActions() {
$this->actions['delete'] = ['icon' => 'trash'];
}
Event Listeners
admingenerator.generate events to modify generation dynamically:
// src/EventListener/AdminGeneratorListener.php
public function onGenerate(GenerateEvent $event) {
$event->setTheme('old');
}
Register in services.yaml:
services:
App\EventListener\AdminGeneratorListener:
tags:
- { name: kernel.event_listener, event: admingenerator.generate }
How can I help you explore Laravel packages today?