ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DefaultMappings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace 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}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
__construct(private readonly string $id, private readonly Container $container)
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
A component is the most general form of an entity in the UI.
Definition: Component.php:28
$container
@noRector
Definition: wac.php:37