Skip to content

Commit

Permalink
Update reference for sprinkle template extension
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Feb 10, 2024
1 parent 58e178d commit 894c4d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
13 changes: 10 additions & 3 deletions pages/20.recipes/03.extending-template/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,24 @@ This is achieved by referencing another sprinkle directly in the `extends` Twig
You can instead extend the same file you're in by adding the sprinkle name in front of the name. For example, for the `pages/user.html.twig` file in the `admin` sprinkle, you can do :

```twig
{% extends "@admin/pages/user.html.twig" %}
{% extends "@admin-sprinkle/pages/user.html.twig" %}
```

This will allow you to replace any Twig `block` definition contained from the `admin` version of the `pages/user.html.twig` template.
This will allow you to replace any Twig `block` definition contained from the `admin` version of the `pages/user.html.twig` template. The identifier for each sprinkle is listed in the table below.

| Name | Slug |
|------------------|------------------|
| Admin Sprinkle | admin-sprinkle |
| AdminLTE Theme | adminlte-theme |
| Account Sprinkle | account-sprinkle |
| Core Sprinkle | core-sprinkle |

## Adding custom menu entries

Adding new link to the built-in menus can be done using the technique above. For example, to add a link to the sidebar menu, all you have to do is create a `navigation/sidebar-menu.html.twig` template in your sprinkle and extending the admin sprinkle version of the same file. You can then add content to the `navigation` block :

```twig
{% extends '@admin/navigation/sidebar-menu.html.twig' %}
{% extends '@admin-sprinkle/navigation/sidebar-menu.html.twig' %}
{% block navigation %}
Expand Down
17 changes: 13 additions & 4 deletions pages/22.upgrading/01.46-to-50/02.guide/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,20 @@ Not must as changed regarding the Resource Locator. Refer to the [Locator Servic

### Template

Two points are to be considered when working with templates:
Three points are to be considered when working with templates:

1. Sprinkles have been renamed. If you're extending a default sprinkle, you'll need to update the sprinkle reference in the `extends` tag. For `{% extends "@admin/pages/activities.html.twig" %}` => `{% extends "@admin-sprinkle/pages/activities.html.twig" %}`
2. In a similar way, some Twig templates have been moved to the "AdminLTE" sprinkle. Be sure to check the new structure if you're extending templates with the `extends` tag. Some templates file previously in the Admin Sprinkle might be in the AdminLTE sprinkle now.
3. FontAwesome has been updated, and references to icon must also be updated : `fa` -> `fas`
First, sprinkles have been renamed. If you're extending a default sprinkle, you'll need to update the sprinkle reference in the `extends` tag. For example: `{% extends "@admin/pages/activities.html.twig" %}` => `{% extends "@admin-sprinkle/pages/activities.html.twig" %}`. Check the table below for a list of sprinkle identifier.

| Name | Slug |
|------------------|------------------|
| Admin Sprinkle | admin-sprinkle |
| AdminLTE Theme | adminlte-theme |
| Account Sprinkle | account-sprinkle |
| Core Sprinkle | core-sprinkle |

In a similar way, some Twig templates have been moved to the "AdminLTE" sprinkle. Be sure to check the new structure if you're extending templates with the `extends` tag. Some templates file previously in the Admin Sprinkle might be in the AdminLTE sprinkle now.

FontAwesome has also been updated, and references to icon must also be updated : `fa` -> `fas`

### Misc

Expand Down

0 comments on commit 894c4d6

Please sign in to comment.