CoolCMS API

RegionSuggestHostTrait

Hosts the region suggest box in the parameter form (type REGION_PICKER).

The component is a Multiplier keyed by the form control name (regionSuggest-parameter_34): one page may hold several fields and the suggest! signal creates the instance itself (without rendering the form). The configuration is therefore derived from the form mode only:

  • edit form (mode FORM): municipality only (tree leaf), preview city/zip/country,
  • filter (mode SEARCH): region, district and municipality, no preview.

The host (AdvertForm, AdvertFilterBox) must have $regionSuggestFactory and $regionManager.

Table of Contents

Constants

REGION_PREVIEW_KEYS  : array<string|int, mixed> = ['city', 'zip', 'country']
Parameters that the preview prefills after a selection (parameter key = item data key).

Methods

createComponentRegionSuggest()  : Multiplier<string|int, RegionSuggest>
buildRegionPreviewFieldMap()  : array<string, string>
initRegionPickerContext()  : void
Selection validator for {@see ParameterFormContext::$regionValidator}: the advert form accepts only an active municipality (tree leaf), so an old advert filed under a country forces choosing a municipality on edit.

Constants

REGION_PREVIEW_KEYS

Parameters that the preview prefills after a selection (parameter key = item data key).

private array<string|int, mixed> REGION_PREVIEW_KEYS = ['city', 'zip', 'country']

Methods

buildRegionPreviewFieldMap()

private buildRegionPreviewFieldMap() : array<string, string>
Return values
array<string, string> —

data key => form control name of the parameter

initRegionPickerContext()

Selection validator for {@see ParameterFormContext::$regionValidator}: the advert form accepts only an active municipality (tree leaf), so an old advert filed under a country forces choosing a municipality on edit.

private initRegionPickerContext() : void
On this page

Search results