mirror of
https://github.com/getgrav/grav.git
synced 2026-07-04 11:57:58 +02:00
Simplified some logic and fixed an issue with system-level process twig logic #1351
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# v1.2.0-rc.3
|
||||
## 03/xx/2017
|
||||
|
||||
1. [](#bugfix)
|
||||
* Simplified modular/twig processing logic and fixed an issue with system process config [#1351](https://github.com/getgrav/grav/issues/1351)
|
||||
|
||||
# v1.2.0-rc.2
|
||||
## 03/17/2017
|
||||
|
||||
|
||||
@@ -575,7 +575,8 @@ class Page
|
||||
|
||||
|
||||
$process_markdown = $this->shouldProcess('markdown');
|
||||
$process_twig = $this->shouldProcess('twig');
|
||||
$process_twig = $this->shouldProcess('twig') || $this->modularTwig() ;
|
||||
|
||||
$cache_enable = isset($this->header->cache_enable) ? $this->header->cache_enable : $config->get('system.cache.enabled',
|
||||
true);
|
||||
$twig_first = isset($this->header->twig_first) ? $this->header->twig_first : $config->get('system.pages.twig_first',
|
||||
@@ -2036,7 +2037,6 @@ class Page
|
||||
if ($var !== null) {
|
||||
$this->modular_twig = (bool)$var;
|
||||
if ($var) {
|
||||
$this->process['twig'] = true;
|
||||
$this->visible(false);
|
||||
// some routable logic
|
||||
if (empty($this->header->routable)) {
|
||||
|
||||
@@ -229,25 +229,22 @@ class Twig
|
||||
$twig_vars['header'] = $item->header();
|
||||
|
||||
$local_twig = clone($this->twig);
|
||||
$modular_twig = $item->modularTwig();
|
||||
$process_twig = isset($item->header()->process['twig']) ? $item->header()->process['twig'] : false;
|
||||
|
||||
$output = '';
|
||||
|
||||
try {
|
||||
// Process Modular Twig
|
||||
if ($modular_twig) {
|
||||
if ($item->modularTwig()) {
|
||||
$twig_vars['content'] = $content;
|
||||
$template = $item->template() . TEMPLATE_EXT;
|
||||
$output = $content = $local_twig->render($template, $twig_vars);
|
||||
}
|
||||
|
||||
// Process in-page Twig
|
||||
if (!$modular_twig || ($modular_twig && $process_twig)) {
|
||||
if ($item->shouldProcess('twig')) {
|
||||
$name = '@Page:' . $item->path();
|
||||
$this->setTemplate($name, $content);
|
||||
$output = $local_twig->render($name, $twig_vars);
|
||||
}
|
||||
|
||||
} catch (\Twig_Error_Loader $e) {
|
||||
throw new \RuntimeException($e->getRawMessage(), 404, $e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user