Overriding Templates
Learn how to override specific templates to customize your panel.
Template Resolution Order
PteroCA looks for templates in this order:
Your theme (
themes/my-theme/)Default theme (
themes/default/)Bundle templates (
vendor/easycorp/easyadmin-bundle/)
If a template exists in your theme, it's used. Otherwise, PteroCA falls back to the default.
Overriding Standard Templates
Step 1: Identify the template you want to customize
Step 2: Find it in the default theme or core
Step 3: Copy it to your theme at the same relative path
Step 4: Customize the template
Example: Customizing the dashboard
# Original location (default theme)
themes/default/panel/pages/dashboard.html.twig
# Your customization location
themes/my-theme/panel/pages/dashboard.html.twigOverriding EasyAdmin Templates Globally
Override templates for ALL CRUD interfaces:
Example: Custom admin panel layout
Overriding Per-CRUD Templates
Override templates for specific CRUD only:
Example: Custom product edit page
Template Inheritance
Use Twig's powerful inheritance system:
Common Blocks to Override
head_stylesheets
CSS includes
Add custom stylesheets
body_javascript
JavaScript includes
Add custom scripts
content_title
Page title
Customize page headers
main
Main content area
Wrap or modify content
sidebar
Sidebar navigation
Custom navigation
navbar
Top navigation bar
Custom navbar
footer
Page footer
Custom footer
flash_messages
Flash notifications
Custom alert styles
Finding Template Names
Method 1: Check default theme structure
Method 2: Check EasyAdmin bundle
Method 3: Enable Twig debug toolbar (dev environment)
Shows which templates are being used
Click on template name to see file path
Tips and Best Practices
Override only what you need - Don't copy entire templates if you're only changing a small section
Use
{{ parent() }}- Include original content when extending blocksTest thoroughly - Ensure overrides work across all pages
Document changes - Add comments explaining why you overrode a template
Keep templates simple - Move complex logic to controllers or services
Watch for updates - Core template changes may affect your overrides
Related Guides
Theme Structure - Directory organization
Twig Guide - Templating syntax and features
Creating Themes - Theme creation workflow
Testing - Quality assurance
Last updated