Issue #2056879 by martin107, Outi, ioskevich, Cottser: Improve twig_* vars DOCs in settings.php and make Twig debug markup require a cache clear.
parent
6cf2b37e90
commit
0526492a1b
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
use Drupal\Core\Extension\Extension;
|
||||
use Drupal\Component\Utility\Settings;
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
|
@ -46,13 +45,14 @@ function twig_init(Extension $theme) {
|
|||
* The output generated by the template, plus any debug information.
|
||||
*/
|
||||
function twig_render_template($template_file, $variables) {
|
||||
$twig_service = \Drupal::service('twig');
|
||||
$output = array(
|
||||
'debug_prefix' => '',
|
||||
'debug_info' => '',
|
||||
'rendered_markup' => \Drupal::service('twig')->loadTemplate($template_file)->render($variables),
|
||||
'rendered_markup' => $twig_service->loadTemplate($template_file)->render($variables),
|
||||
'debug_suffix' => '',
|
||||
);
|
||||
if (Settings::get('twig_debug', FALSE)) {
|
||||
if ($twig_service->isDebug()) {
|
||||
$output['debug_prefix'] .= "\n\n<!-- THEME DEBUG -->";
|
||||
$output['debug_prefix'] .= "\n<!-- CALL: _theme('{$variables['theme_hook_original']}') -->";
|
||||
// If there are theme suggestions, reverse the array so more specific
|
||||
|
|
|
@ -289,6 +289,9 @@ $settings['update_free_access'] = FALSE;
|
|||
* - Twig templates are automatically recompiled whenever the source code
|
||||
* changes (see twig_auto_reload below).
|
||||
*
|
||||
* Note: changes to this setting will only take effect once the cache is
|
||||
* cleared.
|
||||
*
|
||||
* For more information about debugging Twig templates, see
|
||||
* http://drupal.org/node/1906392.
|
||||
*
|
||||
|
@ -303,6 +306,9 @@ $settings['update_free_access'] = FALSE;
|
|||
* you don't provide a value for twig_auto_reload, it will be determined based
|
||||
* on the value of twig_debug.
|
||||
*
|
||||
* Note: changes to this setting will only take effect once the cache is
|
||||
* cleared.
|
||||
*
|
||||
* Not recommended in production environments (Default: NULL).
|
||||
*/
|
||||
# $settings['twig_auto_reload'] = TRUE;
|
||||
|
@ -315,6 +321,9 @@ $settings['update_free_access'] = FALSE;
|
|||
* from source each time they are used. In most cases the twig_auto_reload
|
||||
* setting above should be enabled rather than disabling the Twig cache.
|
||||
*
|
||||
* Note: changes to this setting will only take effect once the cache is
|
||||
* cleared.
|
||||
*
|
||||
* Not recommended in production environments (Default: TRUE).
|
||||
*/
|
||||
# $settings['twig_cache'] = FALSE;
|
||||
|
|
Loading…
Reference in New Issue