diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-10-03 07:14:03 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-10-03 10:37:58 +0200 |
commit | a806e77cb611342c1b5ccd266c9efa79ab2974b0 (patch) | |
tree | 29caa98d9a356c40b9f5655d62b63d03a692e963 /lib/Controller | |
parent | c966aa0d549de74a978a6d3398c157eb966d86cc (diff) |
Implement our own initialStateService for 15
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/PageController.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4f4c722e..eebfccf8 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -25,7 +25,7 @@ namespace OCA\Contacts\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; -use OCP\IInitialStateService; +// use OCP\IInitialStateService; use OCP\L10N\IFactory; use OCP\IRequest; @@ -33,20 +33,20 @@ class PageController extends Controller { protected $appName; - /** @var IInitialStateService */ - private $initialStateService; + // /** @var IInitialStateService */ + // private $initialStateService; /** @var IFactory */ private $languageFactory; public function __construct(string $AppName, IRequest $request, - IInitialStateService $initialStateService, + // IInitialStateService $initialStateService, IFactory $languageFactory) { parent::__construct($AppName, $request); $this->appName = $AppName; - $this->initialStateService = $initialStateService; + // $this->initialStateService = $initialStateService; $this->languageFactory = $languageFactory; } @@ -58,7 +58,8 @@ class PageController extends Controller { */ public function index(): TemplateResponse { $locales = $this->languageFactory->findAvailableLocales(); - $this->initialStateService->provideInitialState($this->appName, 'locales', $locales); - return new TemplateResponse('contacts', 'main'); // templates/main.php + // TODO: use initialStateService once min-version is 16! + // $this->initialStateService->provideInitialState($this->appName, 'locales', $locales); + return new TemplateResponse('contacts', 'main', ['locales' => json_encode($locales)]); // templates/main.php } } |