From 9834ccc9c06517dae1dbe1e3c43764f58c9f7641 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 1 Sep 2019 20:08:55 +0300 Subject: [PATCH] feat(core): add new twig options #186 - debug - charset - cache --- flextype/bootstrap.php | 5 +- flextype/config/settings.yaml | 9 +++ site/plugins/admin/lang/en_US.yaml | 6 +- .../templates/system/settings/index.html | 59 +++++++++++++++---- 4 files changed, 63 insertions(+), 16 deletions(-) diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index fa70e4ed..dad8750e 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -91,8 +91,9 @@ $app = new App([ 'responseChunkSize' => $registry->get('settings.response_chunk_size'), 'httpVersion' => $registry->get('settings.http_version'), 'twig' => [ - 'debug' => $registry->get('settings.errors.display'), - 'cache' => PATH['cache'] . '/twig', + 'charset' => $registry->get('settings.twig.charset'), + 'debug' => $registry->get('settings.twig.debug'), + 'cache' => $registry->get('settings.twig.cache') ? PATH['cache'] . '/twig' : false, 'auto_reload' => $registry->get('settings.twig.auto_reload'), ], 'images' => [ diff --git a/flextype/config/settings.yaml b/flextype/config/settings.yaml index b7f7431b..d186a379 100644 --- a/flextype/config/settings.yaml +++ b/flextype/config/settings.yaml @@ -173,8 +173,17 @@ http_version: '1.1' # for the auto_reload option, it will be determined automatically # based on the debug value. # +# - debug: When set to true, the generated templates have a __toString() +# method that you can use to display the generated nodes +# +# - charset: The charset used by the templates. +# +# - cache: Set false to disable caching. twig: auto_reload: true + cache: true + debug: false + charset: "UTF-8" # Slugify # diff --git a/site/plugins/admin/lang/en_US.yaml b/site/plugins/admin/lang/en_US.yaml index 668f5be4..df430b33 100755 --- a/site/plugins/admin/lang/en_US.yaml +++ b/site/plugins/admin/lang/en_US.yaml @@ -209,7 +209,7 @@ admin_you_have_not_created_any_entries_yet: "You haven't created any entries yet admin_you_have_not_created_any_snippets_yet: "You haven't created any snippets yet!" admin_you_have_not_created_any_templates_yet: "You haven't created any templates yet!" admin_you_have_not_created_any_fieldsets_yet: "You haven't created any fieldsets yet!" -admin_twig_auto_reload: "Twig auto reload" +admin_twig_auto_reload: "Auto reload" admin_display_error_details: "Display error details" admin_add_content_length_header: "Add content length header" admin_router_cache_file: "Route cache file" @@ -245,3 +245,7 @@ admin_slugify_lowercase_after_regexp: "Lowercase after regexp" admin_slugify_regexp: "Regexp" admin_gallery_img: "Gallery Image" admin_tags: "Tags" +admin_twig_templating: "Twig Templating" +admin_twig_debug: "Debug" +admin_twig_charset: "Charset" +admin_twig_cache: "Cache" diff --git a/site/plugins/admin/views/templates/system/settings/index.html b/site/plugins/admin/views/templates/system/settings/index.html index 0afb684c..256cc814 100644 --- a/site/plugins/admin/views/templates/system/settings/index.html +++ b/site/plugins/admin/views/templates/system/settings/index.html @@ -128,7 +128,8 @@
-
+ + @@ -139,7 +140,7 @@

{{ tr('admin_error_404_page') }}


-
+
@@ -149,11 +150,13 @@
-
+
- +
+
+
@@ -162,6 +165,44 @@
+
+
+
+

{{ tr('admin_twig_templating') }}

+
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+
@@ -186,15 +227,6 @@
-
-
- - -
-