# Front-end templates

Front-end output (registration form, fields, attendee list, etc.) is built from templates in this directory. All of these can be overridden by copying them into your theme.

## Override location

Place overrides in your theme (or child theme) under the **`rtec/`** directory, mirroring the paths below.

| Plugin template           | Theme override path      | Description                    |
|---------------------------|--------------------------|--------------------------------|
| `form/rtec.php`           | `rtec/form/shell.php`    | Outer wrapper (shell)          |
| `form/form.php`           | `rtec/form/form.php`     | Main form markup and fields    |
| `form/mvt.php`            | `rtec/form/mvt.php`      | Venue / multi-option fields    |
| `form/field-group.php`    | `rtec/form/field-group.php` | Field group (main + guests) |
| `form/field.php`          | `rtec/form/field.php`    | Single field markup            |

The loader checks the theme first, then falls back to the plugin. Existing overrides using `rtec/form/form.php` and `rtec/form/mvt.php` continue to work.

## Universal wrapper

When the form is injected into the footer and moved by JavaScript (block editor placement), the output is wrapped in a single root element for easier targeting:

- **ID:** `rtec-frontend-root` (filter: `rtec_frontend_wrapper_id`)
- **Class:** `rtec-frontend-root` (filter: `rtec_frontend_wrapper_class`)

To disable the wrapper: `add_filter( 'rtec_use_frontend_wrapper', '__return_false' );`

## Helper and loader

- **`\Roundupwp\Utils\TemplateLoader::get_path( 'shell' | 'form' | 'form-mvt' | 'field-group' | 'field' )`**
  Returns the path to the template file (theme override or plugin default).

- **`\Roundupwp\Utils\TemplateHelper`**
  Provides template-ready data (e.g. form vars) so overrides can stay presentational. Use `new \Roundupwp\Utils\TemplateHelper( $event )` and `get_form_template_vars()` in form overrides if you want to avoid duplicating logic.

## Legacy CSS

For backwards compatibility after upgrades, a legacy stylesheet can be enqueued:

- **Filter:** `add_filter( 'rtec_enqueue_legacy_styles', '__return_true' );`
- **File:** `css/rtec-styles-legacy.css` (placeholder; add your legacy rules or replace the file)
