RegistrationForm
extends BaseComponent
in package
uses
FormTrait, InitTrait
Table of Contents
Properties
- $container : Container
- $onRegistrationSuccess : array<string|int, callable>
- $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
- $blacklistManager : BlacklistManager
- $countryManager : CountryManager
- $paymentRegionManager : PaymentRegionManager
- $userManager : UserManager
- $userTypeManager : UserTypeManager
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
- onError() : void
- onSuccess() : void
- render() : void
- 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.
- validateBlacklist() : void
- One blacklist check of the e-mail, phone and visitor IP ({@see BlacklistManager::findBlacklistedTypes()}), run after the field rules passed. A blocked e-mail or phone is reported at its field, a blocked IP (single address or prefix range) at the form.
- createComponentRegistrationForm() : Form
- 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
- addAddressFields() : void
- addAvatarField() : void
- addCompanyFields() : void
- addContactFields() : void
- addLoginFields() : void
- checkLoggedUser() : bool
- controlText() : string
- Hodnota pole jako string — `IControl::getValue()` je `mixed`.
- 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).
- initializeNewUser() : User
- isFree() : bool
- Translates the `usernameExists()`/`emailExists()` response into a validation rule result.
- preparePaymentRegions() : array<int, string>
-
prepareUserTypes()
: array{array
, int[], int[]}
Properties
$container
public
Container
$container
Attributes
- #[Inject]
$onRegistrationSuccess
public
array<string|int, callable>
$onRegistrationSuccess
= []
$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.system.components.registrationForm'
$blacklistManager read-only
private
BlacklistManager
$blacklistManager
$countryManager read-only
private
CountryManager
$countryManager
$paymentRegionManager read-only
private
PaymentRegionManager
$paymentRegionManager
$userManager read-only
private
UserManager
$userManager
$userTypeManager read-only
private
UserTypeManager
$userTypeManager
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(UserManager $userManager, UserTypeManager $userTypeManager, BlacklistManager $blacklistManager, PaymentRegionManager $paymentRegionManager, CountryManager $countryManager) : mixed
Parameters
- $userManager : UserManager
- $userTypeManager : UserTypeManager
- $blacklistManager : BlacklistManager
- $paymentRegionManager : PaymentRegionManager
- $countryManager : CountryManager
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
onError()
public
onError(Form $form) : void
Parameters
- $form : Form
onSuccess()
public
onSuccess(Form $form, ArrayHash $values) : void
Parameters
- $form : Form
- $values : ArrayHash
render()
public
render([string $style = 'Style_1' ]) : void
Parameters
- $style : string = 'Style_1'
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
TvalidateBlacklist()
One blacklist check of the e-mail, phone and visitor IP ({@see BlacklistManager::findBlacklistedTypes()}), run after the field rules passed. A blocked e-mail or phone is reported at its field, a blocked IP (single address or prefix range) at the form.
public
validateBlacklist(Form $form) : void
IMPORTANT: the query goes through isBlacklisted (blocked types only), not the generic getBy,
which made the whole blacklist readable to anyone with a token. It is fail-closed like
self::isFree(): when the Api does not answer, the registration is refused, otherwise an
outage or a missing grant would silently switch the check off.
Parameters
- $form : Form
createComponentRegistrationForm()
protected
createComponentRegistrationForm() : Form
Return values
FormfrontPresenter()
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
selfaddAddressFields()
private
addAddressFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addAvatarField()
private
addAvatarField(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addCompanyFields()
private
addCompanyFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addContactFields()
private
addContactFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
addLoginFields()
private
addLoginFields(Form $form, callable $t) : void
Parameters
- $form : Form
- $t : callable
checkLoggedUser()
private
checkLoggedUser() : bool
Return values
boolcontrolText()
Hodnota pole jako string — `IControl::getValue()` je `mixed`.
private
controlText(IControl $control) : string
Parameters
- $control : IControl
Return values
stringcreateMultiplierComponent()
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|nullinitializeNewUser()
private
initializeNewUser(ArrayHash $values) : User
Parameters
- $values : ArrayHash
Return values
UserisFree()
Translates the `usernameExists()`/`emailExists()` response into a validation rule result.
private
isFree(bool|null $exists) : bool
IMPORTANT: it replaces isUnique(), which looked the account up itself through
userManager->findBy() = :Api:System:User:getBy. That action is admin-only and returned
null through FailSoftReadTrait under enforce, and null === null evaluated as "the
name is free", so registration reported no duplicates at all and only the unique indexes
uq_username / uq_email remained as a safeguard.
A null (the Api did not answer: guard or outage) is deliberately evaluated as invalid
(fail-closed): the user sees "already exists" and retries, instead of passing on to a
duplicate and failing on the database constraint.
Parameters
- $exists : bool|null
Return values
boolpreparePaymentRegions()
private
preparePaymentRegions() : array<int, string>
Return values
array<int, string>prepareUserTypes()
private
prepareUserTypes() : array{array, int[], int[]}