aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-10-26 15:11:06 +0200
committerWilly Micieli <micieli@laposte.net>2019-10-26 15:11:33 +0200
commitec122b23a04bde14a8bb320b4514f7bfe8af8837 (patch)
tree5c9c503f67d6dd6bc18b261b8a90055e18ba4dd8
parent4f3864a377ce0b78c168110b42969ae24bb2fea7 (diff)
downloadimperium-ec122b23a04bde14a8bb320b4514f7bfe8af8837.zip
imperium-ec122b23a04bde14a8bb320b4514f7bfe8af8837.tar.gz
fix lang define by cookies not used by views
-rw-r--r--imperium/View/View.php64
1 files changed, 30 insertions, 34 deletions
diff --git a/imperium/View/View.php b/imperium/View/View.php
index 29649cf..6acd7b5 100644
--- a/imperium/View/View.php
+++ b/imperium/View/View.php
@@ -2,8 +2,10 @@
namespace Imperium\View
{
-
- use Imperium\Exception\Kedavra;
+
+ use DI\DependencyException;
+ use DI\NotFoundException;
+ use Imperium\Exception\Kedavra;
use Imperium\Flash\Flash;
use Sinergi\BrowserDetector\Os;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
@@ -57,19 +59,21 @@
* @var Environment
*/
private $twig;
-
- /**
- * Twig constructor.
- *
- * @Inject({"views.path", "views.config"})
- *
- * @param string $views_path
- *
- * @param array $config
- *
- * @throws Kedavra
- * @throws LoaderError
- */
+
+ /**
+ * Twig constructor.
+ *
+ * @Inject({"views.path", "views.config"})
+ *
+ * @param string $views_path
+ *
+ * @param array $config
+ *
+ * @throws DependencyException
+ * @throws Kedavra
+ * @throws LoaderError
+ * @throws NotFoundException
+ */
public function __construct(string $views_path, array $config)
{
@@ -95,7 +99,7 @@
$this->twig->addExtension(new ArrayExtension());
$this->twig->addExtension(new TranslationExtension());
-
+
$this->loader()->addPath($views_path . DIRECTORY_SEPARATOR . 'crud', 'crud');
@@ -235,17 +239,18 @@
return $this->loader;
}
-
- /**
- * @throws Kedavra
- *
- * @return string
- *
- */
+
+ /**
+ * @return string
+ *
+ * @throws Kedavra
+ * @throws DependencyException
+ * @throws NotFoundException
+ *
+ */
public function locale() : string
{
-
- return config('locales', 'locale');
+ return app()->lang();
}
/**
@@ -257,7 +262,6 @@
*/
public function domain()
{
-
return config('locales', 'domain');
}
@@ -269,9 +273,7 @@
*/
public function locale_path() : string
{
-
return base('po');
-
}
/**
@@ -284,7 +286,6 @@
*/
public function add_filters(array $filters) : void
{
-
foreach($filters as $filter)
$this->twig()->addFilter($filter);
}
@@ -299,7 +300,6 @@
*/
public function add_test(array $tests) : void
{
-
foreach($tests as $test)
$this->twig()->addTest($test);
}
@@ -314,7 +314,6 @@
*/
public function add_globals(array $globals) : void
{
-
foreach($globals as $k => $v)
$this->twig()->addGlobal($k, $v);
}
@@ -328,7 +327,6 @@
*/
public function add_extensions(array $extensions) : void
{
-
foreach($extensions as $extension)
$this->twig()->addExtension($extension);
}
@@ -341,7 +339,6 @@
*/
public function add_tags(array $extensions) : void
{
-
foreach($extensions as $extension)
$this->twig()->addTokenParser($extension);
}
@@ -351,7 +348,6 @@
*/
public function add_functions(array $functions)
{
-
foreach($functions as $function)
$this->twig()->addFunction($function);
}