class TemplatePackage extends Package implements PackageInterface, ViewComponentsInterface

Template package

Traits

View components trait
Themes trait
Css files trait
Js files trait
View component translations trait

Properties

protected CollectionInterface $properties Package properties from Package
protected PackageRegistryInterface|null $packageRegistry Package Registry Interface from Package
protected string $path Package root path from Package

Methods

__construct(string $path, CollectionInterface $properties, PackageRegistryInterface|null $packageRegistry = null)

Constructor

from Package
array
getDrivers()

Get drivers classes list

from Package
bool
isInstalled()

Return true if package is installed

from Package
validator()

Create package validator

from Package
string
getPath()

Get package root path

from Package
string
getVersion()

Get Package version

from Package
array|null
getLanguages()

Get suppported languages

from Package
bool
setPrimary()

Set package as primary

string|null
getType()

Get package type

from Package
mixed
getInstalOrder(mixed|null $default = null)

Get install order

from Package
string
getName()

Return package name

from Package
Collection
getProperties(bool $full = false)

Get package properties

CollectionInterface
getRequire()

Get require property

from Package
mixed
getProperty(string $name, mixed $default = null)

Get package property

from Package
bool
validate()

Validate package properties

from Package
bool
install(bool|null $primary = null)

Install template package

bool
postInstall()

Run post install actions

from Package
bool
unInstall()

Uninstall package

bool
enable()

Enable package

bool
disable()

Disable package

bool
savePackageProperties()

Save package properties file

from Package
string
getViewPath(string|null $componentsType = null)

Get view path

string
getComponentsPath()

Get components path

string
getPagesPath()

Get pages path

string
getEmailsPath()

Get emails components path

string
getMacrosPath()

Get macros path

array
getMacros(string|null $path = null)

Scan directory and return macros list

array
getPages(string|null $parent = null)

Scan directory and return pages list

array
getEmails(string|null $parent = null)

Scan directory and return emails list

string
getComponentPath(string|null $componentName, string $type = 'components')

Get component path

array
getComponents(string|null $parent = null, string $type = 'components')

Scan directory and return components list

array
getComponentsRecursive(string|null $path = null)

Scan directory and return components list

string|null
getDefautTheme()

Get default theme

from Themes
array
getThemes()

Get themes

from Themes
string
getCssPath()

Get package css path

from CssFiles
array
getCssFiles()

Get package css files

from CssFiles
string
getJsPath()

Get package js path

from JsFiles
array
getJsFiles()

Get package js files

from JsFiles
array
getComponentTranslations(string $componentName, string $type = 'components')

Get package view components translations

array|false
readTranslation(string $componentName, string|null $language, string $type = 'components')

Read language translation

string
getTranslationRelativeFileName(string $componentName, string|null $language, string $type = 'components')

Get translation relative file name path

string
getTranslationFileName(string $componentName, string|null $language, string $type = 'components')

Get translation file name

bool
saveTranslation(array $data, string $componentName, string|null $language, string $type = 'components')

Save translation

mixed
readTranlationProperty(array|string $data, string $key, string $separator = '_', string|null $language = null, string $type = 'components')

Get translation property value

array
setTranslationProperty(array $data, string $key, mixed $value, string $separator = '_')

Set translation property value

string
resolveTranslationFileName(string $path, string|null $language)

Resolve translation file name

bool
hasLanguage(array $translations, string|null $language)

Return true if component have language

array
getComponentLanguages(array $componentFiles)

Get component languages

bool
buildAssets()

Build css template files

array
getRoutes()

Get template routes

Details

in Package at line 53
__construct(string $path, CollectionInterface $properties, PackageRegistryInterface|null $packageRegistry = null)

Constructor

Parameters

string $path
CollectionInterface $properties
PackageRegistryInterface|null $packageRegistry

in Package at line 66
array getDrivers()

Get drivers classes list

Return Value

array

in Package at line 76
bool isInstalled()

Return true if package is installed

Return Value

bool

in Package at line 86
PackageValidator validator()

Create package validator

Return Value

PackageValidator

in Package at line 96
string getPath()

Get package root path

Return Value

string

in Package at line 106
string getVersion()

Get Package version

Return Value

string

in Package at line 116
array|null getLanguages()

Get suppported languages

Return Value

array|null

at line 73
bool setPrimary()

Set package as primary

Return Value

bool

in Package at line 136
string|null getType()

Get package type

Return Value

string|null

in Package at line 147
mixed getInstalOrder(mixed|null $default = null)

Get install order

Parameters

mixed|null $default

Return Value

mixed

in Package at line 157
string getName()

Return package name

Return Value

string

at line 47
Collection getProperties(bool $full = false)

Get package properties

Parameters

bool $full

Return Value

Collection

in Package at line 178
CollectionInterface getRequire()

Get require property

Return Value

CollectionInterface

in Package at line 192
mixed getProperty(string $name, mixed $default = null)

Get package property

Parameters

string $name
mixed $default

Return Value

mixed

in Package at line 202
bool validate()

Validate package properties

Return Value

bool

at line 90
bool install(bool|null $primary = null)

Install template package

Parameters

bool|null $primary Primary package replaces routes or other params

Return Value

bool

in Package at line 223
bool postInstall()

Run post install actions

Return Value

bool

at line 185
bool unInstall()

Uninstall package

Return Value

bool

at line 197
bool enable()

Enable package

Return Value

bool

at line 207
bool disable()

Disable package

Return Value

bool

in Package at line 263
bool savePackageProperties()

Save package properties file

Return Value

bool

in ViewComponents at line 25
string getViewPath(string|null $componentsType = null)

Get view path

Parameters

string|null $componentsType

Return Value

string

in ViewComponents at line 47
string getComponentsPath()

Get components path

Return Value

string

in ViewComponents at line 57
string getPagesPath()

Get pages path

Return Value

string

in ViewComponents at line 67
string getEmailsPath()

Get emails components path

Return Value

string

in ViewComponents at line 77
string getMacrosPath()

Get macros path

Return Value

string

in ViewComponents at line 88
array getMacros(string|null $path = null)

Scan directory and return macros list

Parameters

string|null $path

Return Value

array

in ViewComponents at line 115
array getPages(string|null $parent = null)

Scan directory and return pages list

Parameters

string|null $parent

Return Value

array

in ViewComponents at line 126
array getEmails(string|null $parent = null)

Scan directory and return emails list

Parameters

string|null $parent

Return Value

array

in ViewComponents at line 138
string getComponentPath(string|null $componentName, string $type = 'components')

Get component path

Parameters

string|null $componentName
string $type

Return Value

string

in ViewComponents at line 153
array getComponents(string|null $parent = null, string $type = 'components')

Scan directory and return components list

Parameters

string|null $parent
string $type

Return Value

array

in ViewComponents at line 186
array getComponentsRecursive(string|null $path = null)

Scan directory and return components list

Parameters

string|null $path

Return Value

array

in Themes at line 22
string|null getDefautTheme()

Get default theme

Return Value

string|null

in Themes at line 32
array getThemes()

Get themes

Return Value

array

in CssFiles at line 24
string getCssPath()

Get package css path

Return Value

string

in CssFiles at line 34
array getCssFiles()

Get package css files

Return Value

array

in JsFiles at line 24
string getJsPath()

Get package js path

Return Value

string

in JsFiles at line 34
array getJsFiles()

Get package js files

Return Value

array

in ComponentTranslations at line 39
array getComponentTranslations(string $componentName, string $type = 'components')

Get package view components translations

Parameters

string $componentName
string $type

Return Value

array

in ComponentTranslations at line 67
array|false readTranslation(string $componentName, string|null $language, string $type = 'components')

Read language translation

Parameters

string $componentName
string|null $language
string $type

Return Value

array|false

in ComponentTranslations at line 82
string getTranslationRelativeFileName(string $componentName, string|null $language, string $type = 'components')

Get translation relative file name path

Parameters

string $componentName
string|null $language
string $type

Return Value

string

in ComponentTranslations at line 97
string getTranslationFileName(string $componentName, string|null $language, string $type = 'components')

Get translation file name

Parameters

string $componentName
string|null $language
string $type

Return Value

string

in ComponentTranslations at line 119
bool saveTranslation(array $data, string $componentName, string|null $language, string $type = 'components')

Save translation

Parameters

array $data
string $componentName
string|null $language
string $type

Return Value

bool

in ComponentTranslations at line 145
mixed readTranlationProperty(array|string $data, string $key, string $separator = '_', string|null $language = null, string $type = 'components')

Get translation property value

Parameters

array|string $data
string $key
string $separator
string|null $language
string $type

Return Value

mixed

in ComponentTranslations at line 166
array setTranslationProperty(array $data, string $key, mixed $value, string $separator = '_')

Set translation property value

Parameters

array $data
string $key
mixed $value
string $separator

Return Value

array

in ComponentTranslations at line 178
string resolveTranslationFileName(string $path, string|null $language)

Resolve translation file name

Parameters

string $path
string|null $language

Return Value

string

in ComponentTranslations at line 193
bool hasLanguage(array $translations, string|null $language)

Return true if component have language

Parameters

array $translations
string|null $language

Return Value

bool

in ComponentTranslations at line 206
array getComponentLanguages(array $componentFiles)

Get component languages

Parameters

array $componentFiles

Return Value

array

at line 149
bool buildAssets()

Build css template files

Return Value

bool

at line 217
array getRoutes()

Get template routes

Return Value

array