mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 03:27:08 +02:00
committed by
Andy Miller
parent
634f2bdfa0
commit
9c0f06e306
@@ -156,8 +156,8 @@ class Page
|
||||
protected function processFrontmatter()
|
||||
{
|
||||
// Quick check for twig output tags in frontmatter if enabled
|
||||
if (Utils::contains($this->frontmatter, '{{')) {
|
||||
$process_fields = $this->file()->header();
|
||||
$process_fields = (array)$this->header();
|
||||
if (Utils::contains(json_encode(array_values($process_fields)), '{{')) {
|
||||
$ignored_fields = [];
|
||||
foreach ((array)Grav::instance()['config']->get('system.pages.frontmatter.ignore_fields') as $field) {
|
||||
if (isset($process_fields[$field])) {
|
||||
@@ -325,10 +325,6 @@ class Page
|
||||
$this->header = (object)$file->header();
|
||||
|
||||
if (!Utils::isAdminPlugin()) {
|
||||
// Process frontmatter with Twig if enabled
|
||||
if (Grav::instance()['config']->get('system.pages.frontmatter.process_twig') === true) {
|
||||
$this->processFrontmatter();
|
||||
}
|
||||
// If there's a `frontmatter.yaml` file merge that in with the page header
|
||||
// note page's own frontmatter has precedence and will overwrite any defaults
|
||||
$frontmatter_file = $this->path . '/' . $this->folder . '/frontmatter.yaml';
|
||||
@@ -336,6 +332,10 @@ class Page
|
||||
$frontmatter_data = (array)Yaml::parse(file_get_contents($frontmatter_file));
|
||||
$this->header = (object)array_replace_recursive($frontmatter_data, (array)$this->header);
|
||||
}
|
||||
// Process frontmatter with Twig if enabled
|
||||
if (Grav::instance()['config']->get('system.pages.frontmatter.process_twig') === true) {
|
||||
$this->processFrontmatter();
|
||||
}
|
||||
}
|
||||
} catch (ParseException $e) {
|
||||
$file->raw(Grav::instance()['language']->translate([
|
||||
|
||||
Reference in New Issue
Block a user