Twig hook names
Each Twig template hook and the React slot that replaces it, for moving a theme or an app from Twig.
Read this when you move a Twig theme, or an app that used Twig template hooks, to React.
In Twig, a template placed a hook with {% hook 'cart:items.start' %}. In React, the engine places a slot with <HookSlot name="cart:items.start" />,
and your code fills it with hookRegistry.register (see the Slots overview). Most names stayed the same. This page lists every Twig name and what to use now.
Same name
These work in React under the same name. Only the way you fill them changed.
| Area | Names |
|---|---|
| Page | head:start, head:end, body:start, body:end |
| Product page | product:single.description.start, product:single.description, product:single.description.end, product:single.form.start, product:single.form.end |
| Brands | brands:index.items.start, brands:index.items.end |
| Cart | cart:items.start, cart:items.end, cart:summary.start, cart:summary.end, cart:submit.start, cart:submit.end |
| Account | customer:notifications.items.start, customer:notifications.items.end, customer:orders.index.items.start, customer:orders.index.items.end, customer:orders.single.details.start, customer:orders.single.details.end, customer:wishlist.items.start, customer:wishlist.items.end, customer:profile.form.start, customer:profile.form.end |
| Thank-you page | thank-you:start, thank-you:items.start, thank-you:items.end, thank-you:end |
New name
| Twig | React | Where |
|---|---|---|
product:index.items.start | product:list.items.start | Before the product grid on product listing pages |
product:index.items.end | product:list.items.end | After the product grid |
blog:index.items.start | blog:items.start | Before the article list |
blog:index.items.end | blog:items.end | After the article list |
blog:single.items.start | blog:single.start (closest) | The top of an article page |
blog:single.items.end | blog:single.end (closest) | The bottom of an article page |
No React slot
The engine renders no slot for these. Use the closest one, or the tool listed.
| Twig | Use instead |
|---|---|
brands:single.details.start, brands:single.details.end | product:list.start, which a brand page renders after the brand banner |
brands:single.items.start, brands:single.items.end | product:list.items.start, product:list.items.end |
customer:profile.form.fields.start, customer:profile.form.fields.end | customer:profile.form.start, customer:profile.form.end |
customer:profile.form.submit.start, customer:profile.form.submit.end | customer:profile.form.end |
component:header.menu.start, component:header.menu.end | header:start, header:end, or replace the header (see Header and footer) |
body:classes | useDocumentClass |
<page-slug>:start, <page-slug>:end | The .start and .end slots of that page, listed in the catalog |
React-only slots
React has slots Twig never had, such as header:start, footer:end, home:content, product:details.start, product:related.end, customer:wallet.transactions.start and the blog category, tag and author slots.
The catalog lists them all.
Gotchas
- A name the engine never renders does nothing and raises no error. Check each old name against this page.
- If you replaced a page or layout, render its slots yourself with
HookSlot, with the same names.