1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-25 14:10:44 +02:00

feat(core): add new twig options #186

- debug
- charset
- cache
This commit is contained in:
Awilum
2019-09-01 20:08:55 +03:00
parent 3e9679a57a
commit 9834ccc9c0
4 changed files with 63 additions and 16 deletions

View File

@@ -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' => [

View File

@@ -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
#

View File

@@ -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"

View File

@@ -128,7 +128,8 @@
</div>
<div class="form-group">
<label for="entries[media][upload_images_height]">{{ tr('admin_height') }}</label>
<input type="text" id="systemSettingsSystemEntriesMain" name="entries[media][upload_images_height]" value="{{ registry.settings.entries.media.upload_images_height }}" class="form-control" required="required"> </div>
<input type="text" id="systemSettingsSystemEntriesMain" name="entries[media][upload_images_height]" value="{{ registry.settings.entries.media.upload_images_height }}" class="form-control" required="required">
</div>
</div>
</div>
</div>
@@ -139,7 +140,7 @@
<h3 class="h3 margin-top-none">{{ tr('admin_error_404_page') }}</h3>
<hr>
</div>
<div class="col-md-6">
<div class="col-md-12">
<div class="form-group">
<label for="entries[error404][title]">{{ tr('admin_error404_title') }}</label>
<input type="text" id="systemSettingsSystemEntriesError404Title" name="entries[error404][title]" value="{{ registry.settings.entries.error404.title }}" class="form-control" required="required">
@@ -149,11 +150,13 @@
<input type="text" id="systemSettingsSystemEntriesError404Description" name="entries[error404][description]" value="{{ registry.settings.entries.error404.description }}" class="form-control" required="required">
</div>
</div>
<div class="col-md-6">
<div class="col-md-12">
<div class="form-group">
<label for="entries[error404][content]">{{ tr('admin_error404_content') }}</label>
<input type="text" id="systemSettingsSystemEntriesError404Content" name="entries[error404][content]" value="{{ registry.settings.entries.error404.content }}" class="form-control" required="required">
<textarea id="systemSettingsSystemEntriesError404Content" name="entries[error404][content]" rows="4" cols="80" class="form-control">{{ registry.settings.entries.error404.content }}</textarea>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="entries[error404][template]">{{ tr('admin_error404_template') }}</label>
<input type="text" id="systemSettingsSystemEntriesError404Template" name="entries[error404][template]" value="{{ registry.settings.entries.error404.template }}" class="form-control" required="required">
@@ -162,6 +165,44 @@
</div>
</div>
<div class="tab-pane fade show" id="pills-twig" role="tabpanel" aria-labelledby="pills-twig-tab">
<div class="row">
<div class="col-md-12">
<h3 class="h3 margin-top-none">{{ tr('admin_twig_templating') }}</h3>
<hr>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="twig[auto_reload]">{{ tr('admin_twig_debug') }}</label>
<select id="systemSettingsTwigDebug" name="twig[debug]" class="form-control" required="required">
<option value="0" {% if registry.settings.twig.debug == 0 %}selected{% endif %}>{{ tr('admin_disabled') }}</option>
<option value="1" {% if registry.settings.twig.debug == 1 %}selected{% endif %}>{{ tr('admin_enabled') }}</option>
</select>
</div>
<div class="form-group">
<label for="twig[auto_reload]">{{ tr('admin_twig_auto_reload') }}</label>
<select id="systemSettingsTwigAutoReload" name="twig[auto_reload]" class="form-control" required="required">
<option value="0" {% if registry.settings.twig.auto_reload == 0 %}selected{% endif %}>{{ tr('admin_disabled') }}</option>
<option value="1" {% if registry.settings.twig.auto_reload == 1 %}selected{% endif %}>{{ tr('admin_enabled') }}</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="twig[cache]">{{ tr('admin_twig_cache') }}</label>
<select id="systemSettingsTwigCache" name="twig[cache]" class="form-control" required="required">
<option value="0" {% if registry.settings.twig.cache == 0 %}selected{% endif %}>{{ tr('admin_disabled') }}</option>
<option value="1" {% if registry.settings.twig.cache == 1 %}selected{% endif %}>{{ tr('admin_enabled') }}</option>
</select>
</div>
<div class="form-group">
<label for="twig[charset]">{{ tr('admin_twig_charset') }}</label>
<input type="text" id="systemSettingsTwigCharset" name="twig[charset]" value="{{ registry.settings.twig.charset }}" class="form-control" required="required">
</div>
</div>
</div>
</div>
<div class="tab-pane fade show" id="pills-debugging" role="tabpanel" aria-labelledby="pills-debugging-tab">
<div class="row">
<div class="col-md-12">
@@ -186,15 +227,6 @@
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="twig[auto_reload]">{{ tr('admin_twig_auto_reload') }}</label>
<select id="systemSettingsAutoReload" name="twig[auto_reload]" class="form-control" required="required">
<option value="0" {% if registry.settings.twig.auto_reload == 0 %}selected{% endif %}>{{ tr('admin_disabled') }}</option>
<option value="1" {% if registry.settings.twig.auto_reload == 1 %}selected{% endif %}>{{ tr('admin_enabled') }}</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="whoops[editor]">{{ tr('admin_whoops_editor') }}</label>
@@ -437,6 +469,7 @@
<a class="nav-link" id="pills-content-tab" data-toggle="pill" href="#pills-content" role="tab" aria-controls="pills-content" aria-selected="true">{{ tr('admin_content') }}</a>
<a class="nav-link" id="pills-media-tab" data-toggle="pill" href="#pills-media" role="tab" aria-controls="pills-media" aria-selected="true">{{ tr('admin_media') }}</a>
<a class="nav-link" id="pills-error-tab" data-toggle="pill" href="#pills-error" role="tab" aria-controls="pills-error" aria-selected="true">{{ tr('admin_error_404_page') }}</a>
<a class="nav-link" id="pills-twig-tab" data-toggle="pill" href="#pills-twig" role="tab" aria-controls="pills-twig" aria-selected="true">{{ tr('admin_twig_templating') }}</a>
<a class="nav-link" id="pills-debugging-tab" data-toggle="pill" href="#pills-debugging" role="tab" aria-controls="pills-debugging" aria-selected="true">{{ tr('admin_debugging') }}</a>
<a class="nav-link" id="pills-slim-tab" data-toggle="pill" href="#pills-slim" role="tab" aria-controls="pills-slim" aria-selected="true">{{ tr('admin_slim') }}</a>
<a class="nav-link" id="pills-cache-tab" data-toggle="pill" href="#pills-cache" role="tab" aria-controls="pills-cache" aria-selected="true">{{ tr('admin_cache') }}</a>