Skip to content

Template

Viames Marino edited this page Feb 26, 2026 · 2 revisions

Pair framework: Template

Pair\Models\Template manages installed application templates/themes as plugins.

Main methods

  • getDefault(): ?Template
  • getPluginByName(string $name): ?Template
  • getPath()
  • getBaseFolder(): string
  • getStyleFile(string $styleName): string
  • getPlugin(): Plugin
  • pluginExists(string $name): bool
  • setBase(string $templateName): void
  • storeByPlugin(SimpleXMLElement $options): bool

Lifecycle hook:

  • beforeDelete() removes template plugin folder.

Implementation example

$template = \Pair\Models\Template::getDefault();
$styleFile = $template->getStyleFile('default');

\Pair\Html\TemplateRenderer::parse($styleFile);

Switch base template for derived template:

$template->setBase('default');

See also: TemplateRenderer, Plugin, Application.

Clone this wiki locally