From a806e77cb611342c1b5ccd266c9efa79ab2974b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 3 Oct 2019 07:14:03 +0200 Subject: Implement our own initialStateService for 15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/Controller/PageController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/Controller') 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 } } -- cgit v1.2.3