Templates and form theme
The Twig back-office (the default-twig bundle) renders its pages with standard Twig
templates and standard Symfony forms. There is no Smarty, no {loop}, no {form_field}:
a list page is a .html.twig file, a form is a *Type class rendered with
form_start / form_end, and a custom Bootstrap 5 form theme handles the markup.
This page explains where templates live, how they are organized, and how forms are rendered.
The Smarty default back-office theme is no longer installed as of Thelia 3.2. The back-office
is the default-twig bundle: autonomous in its routes (#[Route] attributes), hooks,
templates, forms and assets.
Templates are namespaced Twig files
Every back-office template is a .html.twig file under the bundle, reachable through the
@BackOfficeDefaultTwig Twig namespace. For example, the brand list is rendered from:
@BackOfficeDefaultTwig/catalog/brand/list.html.twig
The namespace is registered by the bundle in prependExtension(), pointing at the bundle
root (getViewsPath() returns dirname(__DIR__)):
// templates/backOffice/default-twig/src/BackOfficeDefaultTwigBundle.php
public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): void
{
if (!$this->isActive($builder)) {
return;
}
$container->extension('twig', [
'paths' => [
$this->getViewsPath() => 'BackOfficeDefaultTwig',
],
]);
// ...
}
private function getViewsPath(): string
{
// Templates live at the bundle root so the Thelia ParserResolver picks them up
// automatically (`templates/backOffice/<active>/<name>.html.twig`).
return \dirname(__DIR__);
}
extendsWhen a controller calls twig->render() directly (for example an error page), Twig does
not see the bundle root as an implicit search path. {% extends 'base.html.twig' %} then
fails with a LoaderError. Always write
{% extends '@BackOfficeDefaultTwig/base.html.twig' %}.
One folder per business domain
Templates are grouped by business domain, one folder each. The hierarchy stays at three levels of nesting at most:
templates/backOffice/default-twig/
├── base.html.twig # base layout (every screen extends it)
├── auth-layout.html.twig # login screen layout
├── home.html.twig # dashboard
├── _page_header.html.twig # shared partial (title + actions)
├── _side_nav.html.twig # sidebar
├── _top_nav.html.twig # top bar
├── catalog/ # Product, Category, Brand
│ ├── brand/
│ │ ├── list.html.twig
│ │ ├── edit.html.twig
│ │ ├── _create_modal.html.twig
│ │ └── _delete_modal.html.twig