2021-05-31 19:52:39 +02:00
|
|
|
|
# Node
|
|
|
|
|
|
|
|
|
|
A node allows you to create a tree structure in a menu.
|
|
|
|
|
To create or update a node, click on "Edit" or the sign "+". The basic information to fill is `label` but more parameters are accessible via 4 tabs:
|
|
|
|
|
|
|
|
|
|
* Content
|
|
|
|
|
* Routing
|
|
|
|
|
* Attributes
|
|
|
|
|
* Sitemap
|
|
|
|
|
|
|
|
|
|
## Content
|
|
|
|
|
|
|
|
|
|
The content tab allow you to define an optional `Page` to associate to the node. You can also define that the node is an alias of another node.
|
|
|
|
|
|
|
|
|
|
## Routing
|
|
|
|
|
|
|
|
|
|
The routing tab is very important. It allows you to define all parameters related to:
|
|
|
|
|
|
|
|
|
|
* The routing (obviously):
|
2021-05-31 20:15:49 +02:00
|
|
|
|
* An optional URL with parameters
|
|
|
|
|
* A route name generated using the field `code`
|
2021-05-31 19:52:39 +02:00
|
|
|
|
* A custom content-type of the response (eg: 'text/plain')
|
|
|
|
|
* A custom controller called when the node is requested
|
|
|
|
|
|
|
|
|
|
To add a controller in the list, edit `config/packages/app.yaml`:
|
|
|
|
|
|
2023-02-09 21:50:06 +01:00
|
|
|
|
```yaml
|
2021-05-31 19:52:39 +02:00
|
|
|
|
core:
|
|
|
|
|
site:
|
|
|
|
|
controllers:
|
|
|
|
|
- {name: 'Foo', action: 'App\Controller\ExampleController::foo'}
|
|
|
|
|
- {name: 'Bar', action: 'App\Controller\OtherController::bar'}
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-12 00:44:48 +01:00
|
|
|
|
If you need to restrict the access, you can provided a list of roles in the configuration:
|
|
|
|
|
|
|
|
|
|
```yaml title="config/packages/app.yaml"
|
|
|
|
|
core:
|
|
|
|
|
site:
|
|
|
|
|
security:
|
|
|
|
|
roles:
|
|
|
|
|
- {name: 'Foo role', role: 'ROLE_FOO'}
|
|
|
|
|
- {name: 'Bar role', role: 'ROLE_BAR'}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then you will be able to select what roles are required:
|
|
|
|
|
|
|
|
|
|
![](/_static/img/tree/roles.png)
|
|
|
|
|
|
2021-05-31 19:52:39 +02:00
|
|
|
|
## Attributes
|
|
|
|
|
|
|
|
|
|
Attributes are a collection of keys and values attached to a node (eg: class, icon, whatever you want).
|
|
|
|
|
|
|
|
|
|
## Sitemap
|
|
|
|
|
|
|
|
|
|
This tab contains information to configure the sitemap.
|