Skip to content

Template

Viames Marino edited this page Apr 23, 2026 · 3 revisions

Pair framework: Template

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

Main methods

  • getDefault(): ?Template
  • getByName(string $name): ?Template
  • getPath()
  • getPackageBaseFolder(): string
  • getStyleFile(string $styleName): string
  • getInstallablePackage(): InstallablePackage
  • packageRecordExists(string $name): bool
  • setBase(string $templateName): void
  • storeFromPackageManifest(SimpleXMLElement $options): bool

Lifecycle hook:

  • beforeDelete() removes the template package 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, InstallablePackage, Application.

Clone this wiki locally