class JsComponent extends BaseComponent implements HtmlComponentInterface

Js file component

Properties

protected string $name Component name from BaseComponent
protected string $fullName Component full name from BaseComponent
protected string $templateName Template, extension or components library name from BaseComponent
protected string $templateUrl Template url from BaseComponent
protected string $path Component path from BaseComponent
protected integer $location Component Location from BaseComponent
protected string $fullPath Component full path from BaseComponent
protected string $filePath File path from BaseComponent
protected string $language Language code from BaseComponent
protected string $htmlCode Html code from BaseComponent
protected string|null $error Component error code from BaseComponent
protected string $basePath Base path from BaseComponent
protected array $files Component files from BaseComponent
protected string $viewPath View path from BaseComponent
protected string $extensionsPath Extensions path from BaseComponent
protected string $primaryTemplate Primary template name from BaseComponent
protected string $componentType Component type from BaseComponent
protected array $context Component context used in render from BaseComponent
protected $hasHtmlContent Return true if compoent has html file from BaseComponent
protected string|null $htmlFileName Html file name from BaseComponent
protected string $url Component url from BaseComponent
protected array $includedComponents Included compoents from BaseComponent
protected array $options Options from BaseComponent

Methods

__construct(string $name, string $language, string $viewPath, string $extensionsPath, string $primaryTemplate)

Constructor

void
init()

Init component

array
getOptions()

Get options

bool
resolve(array $params = [])

Render component data

bool
isValid()

Return true if component is valid

void
addIncludedComponent(string $name, string $type)

Add included component

array
getIncludedComponents()

Get included components

mixed
create(string $name, string $language)

Create component

array
getContext()

Get context

void
setContext(array $context)

Set context

void
mergeContext(array $data)

Merge context

void
mergeRecursiveContext(array $data)

Merge recursive context

string|null
getIncludeFile(string $fileType)

Get include file url

void
setPrimaryTemplate(string $name)

Set primary template name

string
getPrimaryTemplate()

Get primary template

bool
hasParent()

Return true if component has child

string
getBasePath()

Return base path

string
getName()

Get component name

string|null
getFullName()

Get component full name

string|null
getTemplateFile()

Get template file

bool
hasError()

Return true if have error

bool
hasContent()

Return true if component have html content

void
resolveHtmlContent()

Resolev html content

bool
hasFiles(string|null $fileType = null)

Return true if component have files

array
getFiles(string|null $fileType = null)

Return files

string|null
getPath()

Get path

string
getFullPath()

Get full path

string
getComponentType()

Get component type

void
setComponentType(string $type)

Set component type

int
getLocation()

Get location

string|null
getTemplateName()

Get template or extension name

string
getLanguage()

Get language

string|null
getError()

Get error

string
getHtmlCode()

Get html code

void
setHtmlCode(string $code)

Set html code

void
setError(string $code)

Set error

void
clearContent()

Clear content

mixed
addComponentFile(string $fileExt)

Add component file

void
addFile(array $file, string $fileType)

Add file

void
parseName(string $name)

Parse component name

array
toArray()

Convert to array

string
url()

Get url

string
getRootPath(bool $relative = false)

Get root componetn path

string
getTemplatePath(string $template, int $location)

Get template path

string|false
getComponentFile(string $fileExt)

Get component file

string
getFileUrl(string $fileName)

Convert file path to url

string
getComponentFullPath(int $location, string $templateName)

Get component full path

void
resolvePath()

Resolve component path

string
getTemplateUrl()

Get template url

Details

at line 29
__construct(string $name, string $language, string $viewPath, string $extensionsPath, string $primaryTemplate)

Constructor

Parameters

string $name
string $language
string $viewPath
string $extensionsPath
string $primaryTemplate

at line 49
void init()

Init component

Return Value

void

in BaseComponent at line 237
array getOptions()

Get options

Return Value

array

at line 62
bool resolve(array $params = [])

Render component data

Parameters

array $params

Return Value

bool

at line 39
bool isValid()

Return true if component is valid

Return Value

bool

in BaseComponent at line 270
void addIncludedComponent(string $name, string $type)

Add included component

Parameters

string $name
string $type

Return Value

void

in BaseComponent at line 286
array getIncludedComponents()

Get included components

Return Value

array

in BaseComponent at line 298
mixed create(string $name, string $language)

Create component

Parameters

string $name
string $language

Return Value

mixed

in BaseComponent at line 315
array getContext()

Get context

Return Value

array

in BaseComponent at line 326
void setContext(array $context)

Set context

Parameters

array $context

Return Value

void

in BaseComponent at line 337
void mergeContext(array $data)

Merge context

Parameters

array $data

Return Value

void

in BaseComponent at line 348
void mergeRecursiveContext(array $data)

Merge recursive context

Parameters

array $data

Return Value

void

in BaseComponent at line 359
string|null getIncludeFile(string $fileType)

Get include file url

Parameters

string $fileType

Return Value

string|null

in BaseComponent at line 372
void setPrimaryTemplate(string $name)

Set primary template name

Parameters

string $name

Return Value

void

in BaseComponent at line 382
string getPrimaryTemplate()

Get primary template

Return Value

string

in BaseComponent at line 392
bool hasParent()

Return true if component has child

Return Value

bool

in BaseComponent at line 407
string getBasePath()

Return base path

Return Value

string

in BaseComponent at line 417
string getName()

Get component name

Return Value

string

in BaseComponent at line 427
string|null getFullName()

Get component full name

Return Value

string|null

in BaseComponent at line 438
string|null getTemplateFile()

Get template file

Return Value

string|null

in BaseComponent at line 448
bool hasError()

Return true if have error

Return Value

bool

in BaseComponent at line 458
bool hasContent()

Return true if component have html content

Return Value

bool

in BaseComponent at line 468
protected void resolveHtmlContent()

Resolev html content

Return Value

void

in BaseComponent at line 479
bool hasFiles(string|null $fileType = null)

Return true if component have files

Parameters

string|null $fileType

Return Value

bool

in BaseComponent at line 498
array getFiles(string|null $fileType = null)

Return files

Parameters

string|null $fileType

Return Value

array

in BaseComponent at line 508
string|null getPath()

Get path

Return Value

string|null

in BaseComponent at line 518
string getFullPath()

Get full path

Return Value

string

in BaseComponent at line 528
string getComponentType()

Get component type

Return Value

string

in BaseComponent at line 539
void setComponentType(string $type)

Set component type

Parameters

string $type

Return Value

void

in BaseComponent at line 549
int getLocation()

Get location

Return Value

int

in BaseComponent at line 559
string|null getTemplateName()

Get template or extension name

Return Value

string|null

in BaseComponent at line 569
string getLanguage()

Get language

Return Value

string

in BaseComponent at line 579
string|null getError()

Get error

Return Value

string|null

in BaseComponent at line 589
string getHtmlCode()

Get html code

Return Value

string

in BaseComponent at line 600
void setHtmlCode(string $code)

Set html code

Parameters

string $code

Return Value

void

in BaseComponent at line 611
void setError(string $code)

Set error

Parameters

string $code

Return Value

void

in BaseComponent at line 621
void clearContent()

Clear content

Return Value

void

in BaseComponent at line 636
mixed addComponentFile(string $fileExt)

Add component file

Parameters

string $fileExt

Return Value

mixed

in BaseComponent at line 662
void addFile(array $file, string $fileType)

Add file

Parameters

array $file
string $fileType

Return Value

void

in BaseComponent at line 675
protected void parseName(string $name)

Parse component name

Parameters

string $name

Return Value

void

in BaseComponent at line 733
array toArray()

Convert to array

Return Value

array

in BaseComponent at line 743
string url()

Get url

Return Value

string

in BaseComponent at line 754
string getRootPath(bool $relative = false)

Get root componetn path

Parameters

bool $relative

Return Value

string

in BaseComponent at line 771
string getTemplatePath(string $template, int $location)

Get template path

Parameters

string $template
int $location

Return Value

string

in BaseComponent at line 791
string|false getComponentFile(string $fileExt)

Get component file

Parameters

string $fileExt

Return Value

string|false

in BaseComponent at line 804
string getFileUrl(string $fileName)

Convert file path to url

Parameters

string $fileName

Return Value

string

in BaseComponent at line 815
string getComponentFullPath(int $location, string $templateName)

Get component full path

Parameters

int $location
string $templateName

Return Value

string

in BaseComponent at line 828
protected void resolvePath()

Resolve component path

Return Value

void

in BaseComponent at line 864
string getTemplateUrl()

Get template url

Return Value

string