19declare(strict_types=1);
38 public function __construct(
private readonly
UI $ui,
private readonly Closure $required)
45 $countries = array_combine($countries, array_map($this->
translatedCountry(...), $countries));
47 return $this->
ui->create()->input()->field()->group([
48 'country' => $this->
ui->create()->input()->field()->select(
49 $this->ui->txt(
'country'),
51 )->withRequired(
true, ($this->required)($countries))->withValue(strtoupper($arguments[
'country'] ??
'') ?:
null)
52 ], $this->
ui->txt(
'crit_type_usr_country'), $this->ui->txt(
'crit_type_usr_country_info'));
57 return new UserCountry($criterion, $this, $this->
ui->create());
62 return $this->
ui->txt(
'crit_type_usr_country');
67 return $this->
ui->txt(
'meta_c_' . strtoupper($country));
formGroup(array $arguments=[])
translatedCountry(string $country)
__construct(private readonly UI $ui, private readonly Closure $required)
withCriterion(CriterionContent $criterion)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCountryCodes()
Get country codes (DIN EN 3166-1)
A constraint encodes some resrtictions on values.