.. _extending_roadiz:
================
Extending Roadiz
================
Add back-office entry
---------------------
At first, create a controller into your theme folder, for example ``src/Controller/Admin/AdminController``.
Example:
.. code-block:: php
namespace App\Controller\Admin;
use Themes\Rozier\RozierApp;
use Symfony\Component\HttpFoundation\Request;
class AdminController extends RozierApp
{
public function listAction(
Request $request
) {
return $this->render(
'admin/test.html.twig',
$this->assignation
);
}
}
If you look at this example you can see the class extends ``RozierApp`` class.
This will enable you to “inject” your code into Rozier Back-stage DOM and Style.
Now let's have a look to your twig template file ``templates/admin/test.html.twig``.
.. code-block:: html+jinja
{% extends '@Rozier/layout.html.twig' %}
{% block customStyles %}
{% endblock %}
{% block customScripts %}
{% endblock %}
{% block content %}
{% trans %}Test admin{% endtrans %}
This page is created from MyTheme to show you how to extend backoffice features.
{% endblock %}
The first line is for inheriting from Rozier base template, you can notice that we explicitly choose `@Rozier` namespace.
The two next blocks are made for you to add some CSS or Javascript.
For CSS, the block ``customStyle`` can be use to link an external file with a ```` tag,
the path must be something like that ``{{ asset('static/css/customstyle.css', 'MyTheme') }}``,
or add directly some CSS with "