Profile
extends BaseComponent
in package
uses
InitTrait
Presentation profile of the own company: the only place the template takes the company data itself from (name, slogan, perex, description, logo, hero photo, contact). The other components of the module list its parts (price list, references, parameters); this one lists the company.
Data comes from CompanyManager::findPresented(), a bridge to the narrow Api action presented
(the server picks the presented company itself; the front end never sends companyId). Logo and
hero photo are loaded separately through AssetManager: Company carries only a scalar
FK, not an ORM association (same as ReferenceList).
Styles:
Hero: intro block of the home page (slogan, perex, photo, call to action),Topbar: header contact strip (phone, e-mail, today's hours),AboutMedia: composition of profile gallery photos for the "about us" section (items 1+2, 0 is the hero); without enough photos nothing is rendered,QualityMedia: one gallery photo for the "quality" section (item 3),Portrait: the hero photo (item 0) for a "quote" section, on a theme whoseHerodoes not show it,Gallery: strip of profile gallery photos (items 4+), the "gallery" section,FooterBrand,Contact,Copyright: footer brand (logo, name, perex), contact column (address, phone, e-mail) and copyright row (year + name),Testimonials: client ratings through the Base Rating (styleReviews) over the rating thread of the company; gate:ratingEnabled+ an existing thread, otherwise nothing is rendered.
IMPORTANT: one instance is rendered several times on a page (topbar + intro + reviews). Templates
must not print a bare {$uniqueId}, otherwise the id would be tripled; each style adds its own
suffix to it.
Table of Contents
Constants
- TESTIMONIALS_PER_PAGE : mixed = 3
- How many client reviews are shown at once (a row of cards).
Properties
- $container : Container
- $routerDispatcher : RouterDispatcher
- $translator : ITranslator
- $appContext : AppContext
- $componentParameters : array<string, mixed>
- $currencyContext : CurrencyContext|null
- $deviceDetector : DeviceDetector|null
- $languageContext : LanguageContext|null
- $localizationContext : LocalizationContext|null
- $settingContext : SettingContext
- $themeContext : ThemeContext|null
- $translatorDomain : string|null
- $assetManager : AssetManager
- $company : Company|null
- Presented company; loaded once per request (`createComponentRating` calls it too).
- $companyLoaded : bool
- $companyManager : CompanyManager
- $ratingFactory : RatingFactory
Methods
- __call() : mixed
- Dispatches `renderXyz()` to `render('Xyz', ...$args)`.
- __construct() : mixed
- createComponent() : IComponent|null
- getAppContext() : AppContext
- getComponentParameter() : mixed
- Returns a component parameter, or null when it is not set.
- getContainer() : Container
- getCurrencyContext() : CurrencyContext|null
- getLanguageContext() : LanguageContext|null
- getLocalizationContext() : LocalizationContext|null
- getRouterDispatcher() : RouterDispatcher
- getSettingContext() : SettingContext
- getSettings() : array<int, array<string, mixed>>
- getThemeContext() : ThemeContext|null
- hasServiceByType() : bool
- Returns whether the container has a service of the given type.
- initializeAllContexts() : void
- injectDeviceDetector() : void
- onCreate() : void
- render() : void
- renderAboutMedia() : void
- Composition of gallery photos for the "about us" section (items 1+2, the hero is 0).
- renderContact() : void
- Footer contact column: address, phone, e-mail.
- renderCopyright() : void
- Footer copyright row: year + company name.
- renderFooterBrand() : void
- Footer brand: logo, name and perex of the company.
- renderGallery() : void
- Strip of profile gallery photos (items 4+): the "gallery" section of the home page.
- renderHero() : void
- Intro block of the home page.
- renderPortrait() : void
- Portrait for the "quote" section of the red law-firm theme.
- renderQualityMedia() : void
- Gallery photo for the "quality" section (item 3).
- renderTestimonials() : void
- Client ratings: the Base `RatingComponent` over the company thread.
- renderTopbar() : void
- Header contact strip: phone, e-mail, today's opening hours.
- setAppContext() : $this
- setComponentParameter() : void
- Sets a component parameter.
- setCurrencyContext() : $this
- setLanguageContext() : $this
- setLocalizationContext() : $this
- setSettingContext() : $this
- setThemeContext() : $this
- setup() : void
- setupAppContext() : void
- typedComponent() : T
- Returns a subcomponent with a verified type.
- createComponentRating() : Rating
- Client reviews. The thread belongs to the company (`ratingThreadId`) and is created automatically when the company is saved (Api `CompanyManager` self-heal), so it is only taken over here, never created.
- frontPresenter() : BasePresenter|null
- Returns the front presenter the component is attached to (null outside the front end or when detached).
- getTranslator() : ITranslator
- setTemplateFile() : void
- setTranslator() : self
- createMultiplierComponent() : Multiplier<string|int, IComponent>
- Creates a multiplier for the component.
- createNewComponentInstance() : IComponent|null
- Creates a new component instance without adding it to the presenter; used by the multiplier.
- createStandardComponent() : IComponent|null
- Creates a standard component (not a multiplier).
- loadAsset() : Asset|null
- Returns the asset by its scalar FK (`Company` carries no ORM association), or null.
- prepareCompany() : void
- Loads the company + image channels (logo, hero photo) + the profile gallery. Without a presented company `$company` stays null and templates render nothing; on the front end that is a legitimate state (the company is not set up yet), not an error.
- prepareTodayHours() : void
- Returns the opening hours of today and whether it is open right now.
- resolveTranslation() : object|null
- Returns the company translation in the current language. `LanguageContext::getLang()` returns `int|string|null` (the route can hold an alias) while `getTranslation()` wants an int; without a numeric language the translation is simply not found.
Constants
TESTIMONIALS_PER_PAGE
How many client reviews are shown at once (a row of cards).
private
mixed
TESTIMONIALS_PER_PAGE
= 3
Properties
$container
public
Container
$container
Attributes
- #[Inject]
$routerDispatcher
public
RouterDispatcher
$routerDispatcher
$translator
public
ITranslator
$translator
Tags
$appContext
protected
AppContext
$appContext
$componentParameters
protected
array<string, mixed>
$componentParameters
= []
component parameters set by setComponentParameter()
$currencyContext
protected
CurrencyContext|null
$currencyContext
= NULL
$deviceDetector
protected
DeviceDetector|null
$deviceDetector
= NULL
$languageContext
protected
LanguageContext|null
$languageContext
= NULL
$localizationContext
protected
LocalizationContext|null
$localizationContext
= NULL
$settingContext
protected
SettingContext
$settingContext
$themeContext
protected
ThemeContext|null
$themeContext
= NULL
$translatorDomain
protected
string|null
$translatorDomain
= 'front.company.components.profile'
$assetManager read-only
private
AssetManager
$assetManager
$company
Presented company; loaded once per request (`createComponentRating` calls it too).
private
Company|null
$company
= null
$companyLoaded
private
bool
$companyLoaded
= false
$companyManager read-only
private
CompanyManager
$companyManager
$ratingFactory read-only
private
RatingFactory
$ratingFactory
Methods
__call()
Dispatches `renderXyz()` to `render('Xyz', ...$args)`.
public
__call(string $name, array<string|int, mixed> $args) : mixed
Called only when the component has no renderXyz() method of its own.
Parameters
- $name : string
- $args : array<string|int, mixed>
__construct()
public
__construct(CompanyManager $companyManager, AssetManager $assetManager, RatingFactory $ratingFactory) : mixed
Parameters
- $companyManager : CompanyManager
- $assetManager : AssetManager
- $ratingFactory : RatingFactory
createComponent()
public
createComponent(string $name) : IComponent|null
Parameters
- $name : string
Return values
IComponent|nullgetAppContext()
public
getAppContext() : AppContext
Return values
AppContextgetComponentParameter()
Returns a component parameter, or null when it is not set.
public
getComponentParameter(string $name) : mixed
Parameters
- $name : string
getContainer()
public
getContainer() : Container
Return values
ContainergetCurrencyContext()
public
getCurrencyContext() : CurrencyContext|null
Return values
CurrencyContext|nullgetLanguageContext()
public
getLanguageContext() : LanguageContext|null
Return values
LanguageContext|nullgetLocalizationContext()
public
getLocalizationContext() : LocalizationContext|null
Return values
LocalizationContext|nullgetRouterDispatcher()
public
getRouterDispatcher() : RouterDispatcher
Return values
RouterDispatchergetSettingContext()
public
getSettingContext() : SettingContext
Return values
SettingContextgetSettings()
public
getSettings() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>getThemeContext()
public
getThemeContext() : ThemeContext|null
Return values
ThemeContext|nullhasServiceByType()
Returns whether the container has a service of the given type.
public
hasServiceByType(string $className) : bool
The name is composed dynamically (module plus component), so class_exists() runs first, and
a true result guarantees a valid type.
Parameters
- $className : string
Tags
Return values
boolinitializeAllContexts()
public
initializeAllContexts() : void
injectDeviceDetector()
public
injectDeviceDetector(DeviceDetector $detector) : void
Parameters
- $detector : DeviceDetector
onCreate()
public
onCreate() : void
render()
public
render([string $style = 'Hero' ]) : void
Parameters
- $style : string = 'Hero'
renderAboutMedia()
Composition of gallery photos for the "about us" section (items 1+2, the hero is 0).
public
renderAboutMedia() : void
renderContact()
Footer contact column: address, phone, e-mail.
public
renderContact() : void
renderCopyright()
Footer copyright row: year + company name.
public
renderCopyright() : void
renderFooterBrand()
Footer brand: logo, name and perex of the company.
public
renderFooterBrand() : void
renderGallery()
Strip of profile gallery photos (items 4+): the "gallery" section of the home page.
public
renderGallery() : void
renderHero()
Intro block of the home page.
public
renderHero() : void
renderPortrait()
Portrait for the "quote" section of the red law-firm theme.
public
renderPortrait() : void
Takes the hero photo (gallery item 0); the Hero style does not use it on that theme's home
page (the hero shows a statue instead), so the photo is not repeated on the page. A copy of
renderQualityMedia() with another template and gallery index.
renderQualityMedia()
Gallery photo for the "quality" section (item 3).
public
renderQualityMedia() : void
renderTestimonials()
Client ratings: the Base `RatingComponent` over the company thread.
public
renderTestimonials() : void
renderTopbar()
Header contact strip: phone, e-mail, today's opening hours.
public
renderTopbar() : void
setAppContext()
public
setAppContext(AppContext $appContext) : $this
Parameters
- $appContext : AppContext
Return values
$thissetComponentParameter()
Sets a component parameter.
public
setComponentParameter(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
setCurrencyContext()
public
setCurrencyContext(CurrencyContext|null $currencyContext) : $this
Parameters
- $currencyContext : CurrencyContext|null
Return values
$thissetLanguageContext()
public
setLanguageContext(LanguageContext|null $languageContext) : $this
Parameters
- $languageContext : LanguageContext|null
Return values
$thissetLocalizationContext()
public
setLocalizationContext(LocalizationContext|null $localizationContext) : $this
Parameters
- $localizationContext : LocalizationContext|null
Return values
$thissetSettingContext()
public
setSettingContext(SettingContext $settingContext) : $this
Parameters
- $settingContext : SettingContext
Return values
$thissetThemeContext()
public
setThemeContext(ThemeContext|null $themeContext) : $this
Parameters
- $themeContext : ThemeContext|null
Return values
$thissetup()
public
setup(BasePresenter|BasePresenter $presenter) : void
Parameters
- $presenter : BasePresenter|BasePresenter
setupAppContext()
public
setupAppContext(AppContext $appContext) : void
Parameters
- $appContext : AppContext
typedComponent()
Returns a subcomponent with a verified type.
public
typedComponent(string $name, T> $type) : T
Use it instead of an inline @var above $this['x'] (which does not narrow the type) and
instead of the generic IComponent that $this['x'] returns. See
Form::typedComponent().
Parameters
- $name : string
- $type : T>
Tags
Return values
TcreateComponentRating()
Client reviews. The thread belongs to the company (`ratingThreadId`) and is created automatically when the company is saved (Api `CompanyManager` self-heal), so it is only taken over here, never created.
protected
createComponentRating() : Rating
Return values
RatingfrontPresenter()
Returns the front presenter the component is attached to (null outside the front end or when detached).
protected
frontPresenter() : BasePresenter|null
Return values
BasePresenter|nullgetTranslator()
protected
getTranslator() : ITranslator
Return values
ITranslatorsetTemplateFile()
protected
setTemplateFile(string $dir, string $filename) : void
Parameters
- $dir : string
- $filename : string
setTranslator()
protected
setTranslator(ITranslator $translator) : self
Parameters
- $translator : ITranslator
Return values
selfcreateMultiplierComponent()
Creates a multiplier for the component.
private
createMultiplierComponent(string $name) : Multiplier<string|int, IComponent>
Parameters
- $name : string
Return values
Multiplier<string|int, IComponent>createNewComponentInstance()
Creates a new component instance without adding it to the presenter; used by the multiplier.
private
createNewComponentInstance(string $baseName[, int|string|null $uniqueKey = null ]) : IComponent|null
Parameters
- $baseName : string
- $uniqueKey : int|string|null = null
Return values
IComponent|nullcreateStandardComponent()
Creates a standard component (not a multiplier).
private
createStandardComponent(string $name) : IComponent|null
Parameters
- $name : string
Return values
IComponent|nullloadAsset()
Returns the asset by its scalar FK (`Company` carries no ORM association), or null.
private
loadAsset(int|null $assetId) : Asset|null
Parameters
- $assetId : int|null
Return values
Asset|nullprepareCompany()
Loads the company + image channels (logo, hero photo) + the profile gallery. Without a presented company `$company` stays null and templates render nothing; on the front end that is a legitimate state (the company is not set up yet), not an error.
private
prepareCompany() : void
assetRels.asset is in the includes in addition to the other findPresented() calls
(DefaultTrait/OpeningHoursComponent): only this component renders the gallery, the others do
not need the whole collection (an extra JOIN).
prepareTodayHours()
Returns the opening hours of today and whether it is open right now.
private
prepareTodayHours(Company|null $company) : void
The design's contact strip has a summary like "Mon-Fri 7:00-17:00", which can be composed from
arbitrary opening hours only by guessing (what about an exception on Wednesday?), so today is
shown instead: more specific and always true. OpeningHoursComponent (style Table) renders the
summary of the whole week.
Parameters
- $company : Company|null
resolveTranslation()
Returns the company translation in the current language. `LanguageContext::getLang()` returns `int|string|null` (the route can hold an alias) while `getTranslation()` wants an int; without a numeric language the translation is simply not found.
private
resolveTranslation(Company|null $company) : object|null
Parameters
- $company : Company|null