InitTrait
Configuration and template preparation of the region suggester.
The host sets the configuration when creating the component (also on the suggest! signal,
where the template is not rendered), so it must derive only from the host configuration, not
from the render state.
Table of Contents
Properties
- $fieldMap : array<string, string>
- Item data key (`city`, `zip`, `country`) mapped to the name of a sibling form control that `picker.js` prefills after selection (`data-picker-map-*`). Preview only.
- $leafOnly : bool
- Only leaves of the municipality type (advert form).
- $minLevel : int
- Lowest tree level offered (1 = country too, 2 = from region).
- $placeholderKey : string|null
- Translation key of the own field placeholder (relative to the component domain); `null` = by variant (`placeholder` / `filterPlaceholder`). The watchdog also offers region and district, hence its own text.
Methods
- setFieldMap() : self
- setLeafOnly() : self
- setMinLevel() : self
- setPlaceholderKey() : self
- prepareTemplate() : void
- resolveLanguageId() : int
- resolveMapTargets() : array<string, string>
- `htmlId` of sibling controls for `data-picker-map-*`. A missing control (the parameter is not in the category) is left out.
- resolvePreferRegionId() : int|null
- The country of the website localization (`cms_system_localizations.cms_system_regions_region_id`) takes precedence in the offer.
- resolveRegionLabel() : string
- Label of the stored value (advert edit, filter from URL); a nonexistent id gives empty text.
Properties
$fieldMap
Item data key (`city`, `zip`, `country`) mapped to the name of a sibling form control that `picker.js` prefills after selection (`data-picker-map-*`). Preview only.
private
array<string, string>
$fieldMap
= []
$leafOnly
Only leaves of the municipality type (advert form).
private
bool
$leafOnly
= false
$minLevel
Lowest tree level offered (1 = country too, 2 = from region).
private
int
$minLevel
= 2
$placeholderKey
Translation key of the own field placeholder (relative to the component domain); `null` = by variant (`placeholder` / `filterPlaceholder`). The watchdog also offers region and district, hence its own text.
private
string|null
$placeholderKey
= null
Methods
setFieldMap()
public
setFieldMap(array<string, string> $fieldMap) : self
Parameters
- $fieldMap : array<string, string>
Return values
selfsetLeafOnly()
public
setLeafOnly(bool $leafOnly) : self
Parameters
- $leafOnly : bool
Return values
selfsetMinLevel()
public
setMinLevel(int $minLevel) : self
Parameters
- $minLevel : int
Return values
selfsetPlaceholderKey()
public
setPlaceholderKey(string|null $placeholderKey) : self
Parameters
- $placeholderKey : string|null
Return values
selfprepareTemplate()
private
prepareTemplate(BaseControl $input) : void
Parameters
- $input : BaseControl
resolveLanguageId()
private
resolveLanguageId() : int
Return values
intresolveMapTargets()
`htmlId` of sibling controls for `data-picker-map-*`. A missing control (the parameter is not in the category) is left out.
private
resolveMapTargets(BaseControl $input) : array<string, string>
Parameters
- $input : BaseControl
Return values
array<string, string>resolvePreferRegionId()
The country of the website localization (`cms_system_localizations.cms_system_regions_region_id`) takes precedence in the offer.
private
resolvePreferRegionId() : int|null
Return values
int|nullresolveRegionLabel()
Label of the stored value (advert edit, filter from URL); a nonexistent id gives empty text.
private
resolveRegionLabel(int $regionId) : string
Parameters
- $regionId : int