BaseComponent
class BaseComponent implements ComponentInterface
Base component
Properties
protected string | $name | Component name | |
protected string | $fullName | Component full name | |
protected string | $templateName | Template, extension or components library name | |
protected string | $templateUrl | Template url | |
protected string | $path | Component path | |
protected integer | $location | Component Location | |
protected string | $fullPath | Component full path | |
protected string | $filePath | File path | |
protected string | $language | Language code | |
protected string | $htmlCode | Html code | |
protected string|null | $error | Component error code | |
protected string | $basePath | Base path | |
protected array | $files | Component files | |
protected string | $viewPath | View path | |
protected string | $extensionsPath | Extensions path | |
protected string | $primaryTemplate | Primary template name | |
protected string | $componentType | Component type | |
protected array | $context | Component context used in render | |
protected | $hasHtmlContent | Return true if compoent has html file | |
protected string|null | $htmlFileName | Html file name | |
protected string | $url | Component url | |
protected array | $includedComponents | Included compoents | |
protected array | $options | Options |
Methods
Constructor
Init component
Get options
Resolve component
Return true if component is valid
Add included component
Get included components
Create component
Get context
Set context
Merge context
Merge recursive context
Get include file url
Set primary template name
Get primary template
Return true if component has child
Return base path
Get component name
Get component full name
Get template file
Return true if have error
Return true if component have html content
Resolev html content
Return true if component have files
Return files
Get path
Get full path
Get component type
Set component type
Get location
Get template or extension name
Get language
Get error
Get html code
Set html code
Set error
Clear content
Add component file
Add file
Parse component name
Convert to array
Get url
Get root componetn path
Get template path
Get component file
Convert file path to url
Get component full path
Resolve component path
Get template url
Details
at line 190
__construct(string $name, string $basePath, string $language, string $viewPath, string $extensionsPath, string $primaryTemplate, string $componentType)
Constructor
at line 218
void
init()
Init component
at line 237
array
getOptions()
Get options
at line 248
bool
resolve(array $params = [])
Resolve component
at line 258
bool
isValid()
Return true if component is valid
at line 270
void
addIncludedComponent(string $name, string $type)
Add included component
at line 286
array
getIncludedComponents()
Get included components
at line 298
mixed
create(string $name, string $language)
Create component
at line 315
array
getContext()
Get context
at line 326
void
setContext(array $context)
Set context
at line 337
void
mergeContext(array $data)
Merge context
at line 348
void
mergeRecursiveContext(array $data)
Merge recursive context
at line 359
string|null
getIncludeFile(string $fileType)
Get include file url
at line 372
void
setPrimaryTemplate(string $name)
Set primary template name
at line 382
string
getPrimaryTemplate()
Get primary template
at line 392
bool
hasParent()
Return true if component has child
at line 407
string
getBasePath()
Return base path
at line 417
string
getName()
Get component name
at line 427
string|null
getFullName()
Get component full name
at line 438
string|null
getTemplateFile()
Get template file
at line 448
bool
hasError()
Return true if have error
at line 458
bool
hasContent()
Return true if component have html content
at line 468
protected void
resolveHtmlContent()
Resolev html content
at line 479
bool
hasFiles(string|null $fileType = null)
Return true if component have files
at line 498
array
getFiles(string|null $fileType = null)
Return files
at line 508
string|null
getPath()
Get path
at line 518
string
getFullPath()
Get full path
at line 528
string
getComponentType()
Get component type
at line 539
void
setComponentType(string $type)
Set component type
at line 549
int
getLocation()
Get location
at line 559
string|null
getTemplateName()
Get template or extension name
at line 569
string
getLanguage()
Get language
at line 579
string|null
getError()
Get error
at line 589
string
getHtmlCode()
Get html code
at line 600
void
setHtmlCode(string $code)
Set html code
at line 611
void
setError(string $code)
Set error
at line 621
void
clearContent()
Clear content
at line 636
mixed
addComponentFile(string $fileExt)
Add component file
at line 662
void
addFile(array $file, string $fileType)
Add file
at line 675
protected void
parseName(string $name)
Parse component name
at line 733
array
toArray()
Convert to array
at line 743
string
url()
Get url
at line 754
string
getRootPath(bool $relative = false)
Get root componetn path
at line 771
string
getTemplatePath(string $template, int $location)
Get template path
at line 791
string|false
getComponentFile(string $fileExt)
Get component file
at line 804
string
getFileUrl(string $fileName)
Convert file path to url
at line 815
string
getComponentFullPath(int $location, string $templateName)
Get component full path
at line 828
protected void
resolvePath()
Resolve component path
at line 864
string
getTemplateUrl()
Get template url