ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\ILIASObject\Properties\Translations\Language Class Reference
+ Collaboration diagram for ILIAS\ILIASObject\Properties\Translations\Language:

Public Member Functions

 __construct (private readonly string $language_code, private string $title, private string $description, private bool $default=false, private bool $base=false)
 
 getLanguageCode ()
 
 getTitle ()
 
 withTitle (string $title)
 
 getDescription ()
 
 withDescription (string $description)
 
 isDefault ()
 
 withDefault (bool $default)
 
 isBase ()
 
 withBase (bool $base)
 
 toForm (\ilLanguage $language, FieldFactory $field_factory, Refinery $refinery)
 
 toRow (DataRowBuilder $row_builder, SystemLanguage $lng)
 

Private Member Functions

 getTranslatedLanguageName (SystemLanguage $lng, string $language_code)
 

Detailed Description

Definition at line 29 of file Language.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ILIASObject\Properties\Translations\Language::__construct ( private readonly string  $language_code,
private string  $title,
private string  $description,
private bool  $default = false,
private bool  $base = false 
)

Definition at line 31 of file Language.php.

37 {
38 }

Member Function Documentation

◆ getDescription()

ILIAS\ILIASObject\Properties\Translations\Language::getDescription ( )

Definition at line 57 of file Language.php.

57 : string
58 {
59 return $this->description;
60 }

◆ getLanguageCode()

ILIAS\ILIASObject\Properties\Translations\Language::getLanguageCode ( )

Definition at line 40 of file Language.php.

40 : string
41 {
42 return $this->language_code;
43 }

◆ getTitle()

ILIAS\ILIASObject\Properties\Translations\Language::getTitle ( )

Definition at line 45 of file Language.php.

45 : string
46 {
47 return $this->title;
48 }

◆ getTranslatedLanguageName()

ILIAS\ILIASObject\Properties\Translations\Language::getTranslatedLanguageName ( SystemLanguage  $lng,
string  $language_code 
)
private

Definition at line 139 of file Language.php.

142 : string {
143 return $lng->txt("meta_l_{$language_code}");
144 }
global $lng
Definition: privfeed.php:31

◆ isBase()

ILIAS\ILIASObject\Properties\Translations\Language::isBase ( )

Definition at line 81 of file Language.php.

81 : bool
82 {
83 return $this->base;
84 }

◆ isDefault()

ILIAS\ILIASObject\Properties\Translations\Language::isDefault ( )

Definition at line 69 of file Language.php.

69 : bool
70 {
71 return $this->default;
72 }

◆ toForm()

ILIAS\ILIASObject\Properties\Translations\Language::toForm ( \ilLanguage  $language,
FieldFactory  $field_factory,
Refinery  $refinery 
)

Definition at line 93 of file Language.php.

97 : array {
98 return [
99 $field_factory->group([
100 'language' => $field_factory->hidden()->withValue($this->language_code),
101 'title' => $field_factory->text($language->txt('title'))
102 ->withRequired(true)
103 ->withValue($this->title),
104 'description' => $field_factory->textarea($language->txt('description'))
105 ->withValue($this->description),
106 'default' => $field_factory->hidden()->withValue($this->isDefault()),
107 'base' => $field_factory->hidden()->withValue($this->isBase()),
108 ])->withAdditionalTransformation(
109 $refinery->custom()->transformation(
110 static fn(array $vs): self => new self(
111 $vs['language'],
112 $vs['title'],
113 $vs['description'],
114 $vs['default'] === '1',
115 $vs['base'] === '1'
116 )
117 )
118 )
119 ];
120 }

◆ toRow()

ILIAS\ILIASObject\Properties\Translations\Language::toRow ( DataRowBuilder  $row_builder,
SystemLanguage  $lng 
)

Definition at line 122 of file Language.php.

125 : DataRow {
126 return $row_builder->buildDataRow(
127 $this->language_code,
128 [
129 'language' => $this->getTranslatedLanguageName($lng, $this->language_code),
130 'base' => $this->isBase(),
131 'default' => $this->isDefault(),
132 'title' => $this->getTitle(),
133 'description' => $this->getDescription()
134 ]
135 )->withDisabledAction(TranslationsTable::ACTION_DELETE, $this->isBase() || $this->isDefault())
136 ->withDisabledAction(TranslationsTable::ACTION_MAKE_DEFAULT, $this->isDefault());
137 }
getTranslatedLanguageName(SystemLanguage $lng, string $language_code)
Definition: Language.php:139
buildDataRow(string $id, array $record)

◆ withBase()

ILIAS\ILIASObject\Properties\Translations\Language::withBase ( bool  $base)

Definition at line 86 of file Language.php.

86 : self
87 {
88 $clone = clone $this;
89 $clone->base = $base;
90 return $clone;
91 }

◆ withDefault()

ILIAS\ILIASObject\Properties\Translations\Language::withDefault ( bool  $default)

Definition at line 74 of file Language.php.

74 : self
75 {
76 $clone = clone $this;
77 $clone->default = $default;
78 return $clone;
79 }

◆ withDescription()

ILIAS\ILIASObject\Properties\Translations\Language::withDescription ( string  $description)

Definition at line 62 of file Language.php.

62 : self
63 {
64 $clone = clone $this;
65 $clone->description = $description;
66 return $clone;
67 }

◆ withTitle()

ILIAS\ILIASObject\Properties\Translations\Language::withTitle ( string  $title)

Definition at line 50 of file Language.php.

50 : self
51 {
52 $clone = clone $this;
53 $clone->title = $title;
54 return $clone;
55 }

The documentation for this class was generated from the following file: