ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DefaultMappings.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\LegalDocuments;
22 
31 
33 {
34  public function __construct(
35  private readonly string $id,
36  private readonly Container $container
37  ) {
38  }
39 
44  {
45  $ui = new UI(
46  $this->id,
47  $this->container->ui(),
48  $this->container->language()
49  );
50 
51  $this->container->language()->loadLanguageModule('rbac');
52  $this->container->language()->loadLanguageModule('meta');
53 
54  $required = fn(array $options): Constraint => $this->container->refinery()->custom()->constraint(
55  static fn(?string $s): bool => $s !== null && isset($options[$s]),
56  static fn(): string => $ui->txt('msg_input_is_required')
57  );
58 
59  return new SelectionMap([
60  'usr_global_role' => new RoleDefinition($ui, $this->container['ilObjDataCache'], $this->container->rbac()->review(), $required),
61  'usr_language' => new UserLanguageDefinition($ui, $this->container->language()->getInstalledLanguages(), $required),
62  'usr_country' => new UserCountryDefinition($ui, $required),
63  ], 'usr_country');
64  }
65 
69  public function contentAsComponent(): array
70  {
71  return [
72  'html' => fn($x) => $this->container->ui()->factory()->legacy()->content($x->value()),
73  ];
74  }
75 }
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$container
Definition: wac.php:36
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(private readonly string $id, private readonly Container $container)