The booking form and the e-mails of WXP Restaurant Reservations are Twig templates. This guide lists the templates, the values they receive and how to make your own. For an introduction to Twig and the lookup order, see General Developer Information → Twig.
Templates #
| File | Name | What it is |
|---|---|---|
booking-form.html.twig |
Booking form | The form on the page. Used by the shortcode, the block and the widget through the template parameter. |
mail-simple.html.twig |
Simple | A plain e-mail. The mail template is chosen in the settings. |
mail-modern.html.twig |
Modern | An e-mail with a coloured header and a button. |
A template name that does not exist falls back to booking-form. The mail templates are called mail- plus the name that is chosen in the settings, so mail-mine.html.twig is available as “mine”.
The booking form #
- Copy
booking-form.html.twigtowxp-restaurant-reservations/in your child theme and change the copy. The file holds the markup and the texts. - Keep the
data-wxp-rr-*attributes. The script fills the calendar and the times and talks to the server; it finds its parts with these attributes. - Use the name in the shortcode:
[wxp_restaurant_reservations template="my-form"]for a filemy-form.html.twig.
| Name | Contents |
|---|---|
form |
The state of the form (state is ready when bookings are accepted) and its options, such as form.kids. |
labels |
All translated texts. |
user |
name and email of a logged in user, empty for visitors. |
zone |
The area of the restaurant: id and label. |
consent_text, privacy_url |
The text of the consent checkbox (see the filter wxp_rr_consent_text) and the link to the privacy page. |
number, box_id, is_manager |
The start number of guests, a unique id on the page, and whether the visitor can manage the plugin. |
The e-mails #
An e-mail template is a complete HTML page with inline styles, because mail programs ignore stylesheets. Copy mail-simple.html.twig or mail-modern.html.twig to your child theme and start from there.
| Name | Contents |
|---|---|
subject, lang |
The subject and the language code. |
intro, restaurant |
The opening text and the name of the restaurant. |
rows |
The details of the reservation: each row has a label and a value. |
button |
The button, if there is one: label and url. |
color, site_url |
The accent colour and the address of the website. |
Change the message afterwards, or switch a mail off, with the filters wxp_rr_mail_message and wxp_rr_mail_enabled. Add your own values with wxp_rr_template_context.