Documentation

TwigTemplateBase extends TemplateBase
in package

AbstractYes

Base class which templates should extend to add functionality.

Uses Twig template engine.

Tags
author

Samerton

version
2.2.0
license

MIT

Table of Contents

Properties

$_assets_resolver  : AssetResolver
$_author  : string
$_css  : array<string|int, mixed>
$_engine  : TemplateEngine
$_js  : array<string|int, mixed>
$_name  : string
$_nameless_version  : string
$_settings  : string
$_version  : string

Methods

__construct()  : mixed
addCSSFiles()  : void
Add list of CSS files to be loaded on each page load.
addCSSStyle()  : void
Add internal CSS styling to this page load.
addJSFiles()  : void
Add list of Javascript files to be loaded on each page load.
addJSScript()  : void
Add internal JS code to this page load.
assets()  : AssetResolver
displayTemplate()  : void
Render this template.
getAuthor()  : string
Get name of author of this template.
getCSS()  : array<string|int, mixed>
Get all internal CSS styles.
getEngine()  : TemplateEngine
Get template engine.
getJS()  : array<string|int, mixed>
Get all internal JS code.
getName()  : string
Get name of this template.
getNamelessVersion()  : string
Get NamelessMC version of this template.
getSettings()  : string
Get settings URL of this template.
getTemplate()  : string
Fetches template HTML instead of rendering it.
getVersion()  : string
Get version of this template.
onPageLoad()  : mixed
Handle page loading.

Properties

$_author

protected string $_author = ''

The template author name (supports HTML)

$_css

protected array<string|int, mixed> $_css = []

Array of CSS scripts to add to the template.

$_js

protected array<string|int, mixed> $_js = []

Array of JS scripts to add to the template.

$_nameless_version

protected string $_nameless_version = ''

The NamelessMC version this template supports.

$_settings

protected string $_settings = ''

The template settings URL.

$_version

protected string $_version = ''

The template version

Methods

__construct()

public __construct(string $name, string $version, string $nameless_version, string $author, string $dir) : mixed
Parameters
$name : string
$version : string
$nameless_version : string
$author : string
$dir : string

addCSSFiles()

Add list of CSS files to be loaded on each page load.

public addCSSFiles(array<string|int, mixed> $files) : void
Parameters
$files : array<string|int, mixed>

Files to be loaded.

addCSSStyle()

Add internal CSS styling to this page load.

public addCSSStyle([string|null $style = null ]) : void
Parameters
$style : string|null = null

Styling to add.

addJSFiles()

Add list of Javascript files to be loaded on each page load.

public addJSFiles(array<string|int, mixed> $files) : void
Parameters
$files : array<string|int, mixed>

Files to be loaded.

addJSScript()

Add internal JS code to this page load.

public addJSScript([string|null $script = null ]) : void
Parameters
$script : string|null = null

displayTemplate()

Render this template.

public displayTemplate(string $template) : void
Parameters
$template : string

Template file to render, relative to template base directory

getAuthor()

Get name of author of this template.

public getAuthor() : string
Return values
string

Author name of template.

getCSS()

Get all internal CSS styles.

public getCSS() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of strings of CSS.

getJS()

Get all internal JS code.

public getJS() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of strings of JS.

getName()

Get name of this template.

public getName() : string
Return values
string

Name of template.

getNamelessVersion()

Get NamelessMC version of this template.

public getNamelessVersion() : string
Return values
string

NamelessMC version of template.

getSettings()

Get settings URL of this template.

public getSettings() : string
Return values
string

Settings URL of template.

getTemplate()

Fetches template HTML instead of rendering it.

public getTemplate(string $template) : string
Parameters
$template : string
Return values
string

Generated HTML

getVersion()

Get version of this template.

public getVersion() : string
Return values
string

Version of template.

onPageLoad()

Handle page loading.

public abstract onPageLoad() : mixed

        
On this page

Search results