Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/SignalSlot/LanguageService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\SignalSlot;
8
9 use eZ\Publish\API\Repository\LanguageService as LanguageServiceInterface;
10 use eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct;
11 use eZ\Publish\API\Repository\Values\Content\Language;
12 use eZ\Publish\Core\SignalSlot\Signal\LanguageService\CreateLanguageSignal;
13 use eZ\Publish\Core\SignalSlot\Signal\LanguageService\UpdateLanguageNameSignal;
14 use eZ\Publish\Core\SignalSlot\Signal\LanguageService\EnableLanguageSignal;
15 use eZ\Publish\Core\SignalSlot\Signal\LanguageService\DisableLanguageSignal;
16 use eZ\Publish\Core\SignalSlot\Signal\LanguageService\DeleteLanguageSignal;
17
21 class LanguageService implements LanguageServiceInterface
22 {
28 protected $service;
29
35 protected $signalDispatcher;
36
46 public function __construct(LanguageServiceInterface $service, SignalDispatcher $signalDispatcher)
47 {
48 $this->service = $service;
49 $this->signalDispatcher = $signalDispatcher;
50 }
51
62 public function createLanguage(LanguageCreateStruct $languageCreateStruct)
63 {
64 $returnValue = $this->service->createLanguage($languageCreateStruct);
65 $this->signalDispatcher->emit(
66 new CreateLanguageSignal(
67 [
68 'languageId' => $returnValue->id,
69 ]
70 )
71 );
72
73 return $returnValue;
74 }
75
86 public function updateLanguageName(Language $language, $newName)
87 {
88 $returnValue = $this->service->updateLanguageName($language, $newName);
89 $this->signalDispatcher->emit(
90 new UpdateLanguageNameSignal(
91 [
92 'languageId' => $language->id,
93 'newName' => $newName,
94 ]
95 )
96 );
97
98 return $returnValue;
99 }
100
110 public function enableLanguage(Language $language)
111 {
112 $returnValue = $this->service->enableLanguage($language);
113 $this->signalDispatcher->emit(
114 new EnableLanguageSignal(
115 [
116 'languageId' => $language->id,
117 ]
118 )
119 );
120
121 return $returnValue;
122 }
123
133 public function disableLanguage(Language $language)
134 {
135 $returnValue = $this->service->disableLanguage($language);
136 $this->signalDispatcher->emit(
137 new DisableLanguageSignal(
138 [
139 'languageId' => $language->id,
140 ]
141 )
142 );
143
144 return $returnValue;
145 }
146
156 public function loadLanguage($languageCode)
157 {
158 return $this->service->loadLanguage($languageCode);
159 }
160
166 public function loadLanguages()
167 {
168 return $this->service->loadLanguages();
169 }
170
180 public function loadLanguageById($languageId)
181 {
182 return $this->service->loadLanguageById($languageId);
183 }
184
188 public function loadLanguageListByCode(array $languageCodes): iterable
189 {
190 return $this->service->loadLanguageListByCode($languageCodes);
191 }
192
196 public function loadLanguageListById(array $languageIds): iterable
197 {
198 return $this->service->loadLanguageListById($languageIds);
199 }
200
211 public function deleteLanguage(Language $language)
212 {
213 $returnValue = $this->service->deleteLanguage($language);
214 $this->signalDispatcher->emit(
215 new DeleteLanguageSignal(
216 [
217 'languageId' => $language->id,
218 ]
219 )
220 );
221
222 return $returnValue;
223 }
224
230 public function getDefaultLanguageCode()
231 {
232 return $this->service->getDefaultLanguageCode();
233 }
234
240 public function newLanguageCreateStruct()
241 {
242 return $this->service->newLanguageCreateStruct();
243 }
244 }
eZ\Publish\API\Repository\Values\Content\LanguageCreateStruct
This class represents a value for creating a language.
Definition: LanguageCreateStruct.php:15
eZ\Publish\API\Repository\Values\Content\Language
Definition: API/Repository/Values/Content/Language.php:20
eZ\Publish\Core\SignalSlot\LanguageService
LanguageService class.
Definition: Core/SignalSlot/LanguageService.php:22
eZ\Publish\Core\SignalSlot\LanguageService\newLanguageCreateStruct
newLanguageCreateStruct()
Instantiates an object to be used for creating languages.
Definition: Core/SignalSlot/LanguageService.php:240
eZ\Publish\Core\SignalSlot\LanguageService\$service
$service
Definition: Core/SignalSlot/LanguageService.php:28
eZ\Publish\Core\SignalSlot\LanguageService\loadLanguageById
loadLanguageById($languageId)
Loads a Language by its id ($languageId).
Definition: Core/SignalSlot/LanguageService.php:180
eZ\Publish\Core\SignalSlot\LanguageService\loadLanguageListById
loadLanguageListById(array $languageIds)
{Bulk-load Languages by ids.Note: it does not throw exceptions on load, just ignores erroneous Langua...
Definition: Core/SignalSlot/LanguageService.php:196
eZ\Publish\Core\SignalSlot\LanguageService\deleteLanguage
deleteLanguage(Language $language)
Deletes a language from content repository.
Definition: Core/SignalSlot/LanguageService.php:211
eZ\Publish\Core\SignalSlot\LanguageService\loadLanguages
loadLanguages()
Loads all Languages.
Definition: Core/SignalSlot/LanguageService.php:166
eZ\Publish\Core\SignalSlot\LanguageService\loadLanguage
loadLanguage($languageCode)
Loads a Language from its language code ($languageCode).
Definition: Core/SignalSlot/LanguageService.php:156
eZ\Publish\Core\SignalSlot\LanguageService\$signalDispatcher
$signalDispatcher
Definition: Core/SignalSlot/LanguageService.php:35
eZ\Publish\Core\SignalSlot\LanguageService\loadLanguageListByCode
loadLanguageListByCode(array $languageCodes)
{Bulk-load Languages by language codes.Note: it does not throw exceptions on load,...
Definition: Core/SignalSlot/LanguageService.php:188
eZ\Publish\Core\SignalSlot\LanguageService\createLanguage
createLanguage(LanguageCreateStruct $languageCreateStruct)
Creates the a new Language in the content repository.
Definition: Core/SignalSlot/LanguageService.php:62
eZ\Publish\Core\SignalSlot\LanguageService\disableLanguage
disableLanguage(Language $language)
Disables a language.
Definition: Core/SignalSlot/LanguageService.php:133
eZ\Publish\Core\SignalSlot\LanguageService\getDefaultLanguageCode
getDefaultLanguageCode()
Returns a configured default language code.
Definition: Core/SignalSlot/LanguageService.php:230
eZ\Publish\Core\SignalSlot\LanguageService\enableLanguage
enableLanguage(Language $language)
Enables a language.
Definition: Core/SignalSlot/LanguageService.php:110
eZ\Publish\Core\SignalSlot\LanguageService\updateLanguageName
updateLanguageName(Language $language, $newName)
Changes the name of the language in the content repository.
Definition: Core/SignalSlot/LanguageService.php:86
eZ\Publish\Core\SignalSlot\LanguageService\__construct
__construct(LanguageServiceInterface $service, SignalDispatcher $signalDispatcher)
Constructor.
Definition: Core/SignalSlot/LanguageService.php:46
eZ\Publish\Core\SignalSlot\SignalDispatcher
Dispatches Signals to their assigned Slots.
Definition: SignalDispatcher.php:20
eZ\Publish\Core\SignalSlot\Signal\LanguageService\CreateLanguageSignal
CreateLanguageSignal class.
Definition: CreateLanguageSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\LanguageService\DeleteLanguageSignal
DeleteLanguageSignal class.
Definition: DeleteLanguageSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\LanguageService\DisableLanguageSignal
DisableLanguageSignal class.
Definition: DisableLanguageSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\LanguageService\EnableLanguageSignal
EnableLanguageSignal class.
Definition: EnableLanguageSignal.php:15
eZ\Publish\Core\SignalSlot\Signal\LanguageService\UpdateLanguageNameSignal
UpdateLanguageNameSignal class.
Definition: UpdateLanguageNameSignal.php:15
eZ\Publish\API\Repository\LanguageService
Language service, used for language operations.
Definition: API/Repository/LanguageService.php:16
eZ\Publish\Core\SignalSlot
Definition: Core/SignalSlot/BookmarkService.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.