diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-10-26 16:03:20 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-10-26 17:42:13 +0100 |
| commit | 7ef421a4290b6b468944b845497d6139b0eddd3f (patch) | |
| tree | 5670a1b7c65b1d71f84e679dfa260b1307479c84 /modules_v4 | |
| parent | 695d960dba210b49e93a3e542347d010adcc6576 (diff) | |
| download | webtrees-7ef421a4290b6b468944b845497d6139b0eddd3f.tar.gz webtrees-7ef421a4290b6b468944b845497d6139b0eddd3f.tar.bz2 webtrees-7ef421a4290b6b468944b845497d6139b0eddd3f.zip | |
Remove LocaleInterface as dependency of LocalizationService
Diffstat (limited to 'modules_v4')
| -rw-r--r-- | modules_v4/README.md | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules_v4/README.md b/modules_v4/README.md index 75ddc3af5b..45955c639e 100644 --- a/modules_v4/README.md +++ b/modules_v4/README.md @@ -142,12 +142,16 @@ Note that you cannot type-hint the following objects in the constructor, as they created until after the modules. * other modules -* interfaces, such as `UserInterface` (the current user) +* interfaces, such as `UserInterface` or `LocaleInterface` (the current user and language) * the current tree `Tree` or objects that depend on it (`Statistics`) as these objects are not created until after the module is created. -Instead, you can fetch these items when they are needed from the "application container" using: -``` $user = app(UserInterface::class)``` +Instead, the user, tree and locale can be obtained from the request object. e.g. +```php +$tree = $request->getAttribute('tree'); +$user = $request->getAttribute('user'); +$locale = $request->getAttribute('locale'); +``` ```php <?php |
