ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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.

Referenced by ILIAS\ILIASObject\Properties\Translations\Language\toRow().

57  : string
58  {
59  return $this->description;
60  }
+ Here is the caller graph for this function:

◆ getLanguageCode()

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

Definition at line 40 of file Language.php.

Referenced by ILIAS\ILIASObject\Properties\Translations\Translations\withLanguage().

40  : string
41  {
42  return $this->language_code;
43  }
+ Here is the caller graph for this function:

◆ getTitle()

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

Definition at line 45 of file Language.php.

Referenced by ILIAS\ILIASObject\Properties\Translations\Language\toRow().

45  : string
46  {
47  return $this->title;
48  }
+ Here is the caller graph for this function:

◆ getTranslatedLanguageName()

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

Definition at line 139 of file Language.php.

Referenced by ILIAS\ILIASObject\Properties\Translations\Language\toRow().

142  : string {
143  return $lng->txt("meta_l_{$language_code}");
144  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ isBase()

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

Definition at line 81 of file Language.php.

Referenced by ILIAS\ILIASObject\Properties\Translations\Language\toForm(), ILIAS\ILIASObject\Properties\Translations\Language\toRow(), and ILIAS\ILIASObject\Properties\Translations\Translations\withLanguage().

81  : bool
82  {
83  return $this->base;
84  }
+ Here is the caller graph for this function:

◆ isDefault()

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

Definition at line 69 of file Language.php.

Referenced by ILIAS\ILIASObject\Properties\Translations\Language\toForm(), ILIAS\ILIASObject\Properties\Translations\Language\toRow(), and ILIAS\ILIASObject\Properties\Translations\Translations\withLanguage().

69  : bool
70  {
71  return $this->default;
72  }
+ Here is the caller graph for this function:

◆ toForm()

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

Definition at line 93 of file Language.php.

References ILIAS\ILIASObject\Properties\Translations\Language\isBase(), ILIAS\ILIASObject\Properties\Translations\Language\isDefault(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

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()),
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  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:

◆ toRow()

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

Definition at line 122 of file Language.php.

References ILIAS\ILIASObject\Properties\Translations\TranslationsTable\ACTION_DELETE, ILIAS\ILIASObject\Properties\Translations\TranslationsTable\ACTION_MAKE_DEFAULT, ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow(), ILIAS\ILIASObject\Properties\Translations\Language\getDescription(), ILIAS\ILIASObject\Properties\Translations\Language\getTitle(), ILIAS\ILIASObject\Properties\Translations\Language\getTranslatedLanguageName(), ILIAS\ILIASObject\Properties\Translations\Language\isBase(), and ILIAS\ILIASObject\Properties\Translations\Language\isDefault().

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
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ 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: