# API - Template Components

Shared page, block, and display helpers for `ComponentsTemplateBase` and theme overrides.

## Base API

`src/core/templates/components-base.template.php`

| Method | Inputs | Description |
|---|---|---|
| `setMetaTags` | `$title=null`, `$description=null`, `$keywords=null` | Set page metadata; null uses defaults and empty strings omit optional tags |
| `setMetaImage` | `$image` | Override the default Open Graph image |
| `setMetaRefresh` | `$seconds` | Add a response refresh meta tag |
| `printMetaTags` | none | Render title, base, SEO, Open Graph, and configured refresh tags |
| `PageTitle` | `$title` | Page title |
| `StartPage` | `$id=''` | Open page |
| `EndPage` | none | Close page |
| `StartBlock` | `$sectionName=''` | Open block |
| `BlockTitle` | `$title` | Block title |
| `SubTitle` | `$title` | Alias title |
| `EndBlock` | none | Close block |
| `showAButton` | `$text`, `$url`, `$target=''`, `$additionalClasses=''`, `$attributes=null` | Link button |
| `showAccordion` | `$titleRaw`, `$contentRaw` | Accordion |
| `printFields` | `$playerInfoFields` | Field rows |

## Notes

| Method | Note |
|---|---|
| `showAButton` | Uses `FormComponentsBase::printAttributes()` |
| `SubTitle` | Calls `BlockTitle()` |
| `printFields` | Skips null values |

## Theme overrides

- `src/templates/{theme}/components.template.php`

## Advanced Components

`ComponentsAdvanced` is the swappable integration boundary for third-party editor/tree libraries. The base API is in `src/core/templates/components-advanced.template.php`; the current implementation is in `src/templates/magic/components-advanced.template.php`. SunEditor dependency assets are emitted lazily by `ComponentsAdvancedBase::showSunEditor()`, and FLMngr is emitted only when enabled in `config-admin.php`, so themes do not load editor dependencies directly. SunEditor and FLMngr backend helpers live under `src/core/editors/sun-editor/` and `src/core/file-manager/flmngr/` respectively, including their runtime assets.

| Method | Inputs | Description |
|---|---|---|
| `showSunEditor` | `$name`, `$value`, `$attributes=[]` | Render an HTML content editor; content is stored as SunEditor HTML |
| `showTree` | `$id`, `$data`, `$attributes=[]` | Render a sortable tree |
| `loadSunEditor` | none | Load editor assets once |
| `loadTree` | none | Load tree assets once |
| `importCSS` | `$path` | Import a stylesheet |
| `importJS` | `$path` | Import a JavaScript file |
| `importFontAwesome` | none | Import the copied Font Awesome stylesheet once |
