Skip to content

Commit

Permalink
theme_var() twig function now checks page header var first
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Mar 2, 2018
1 parent 5ffe32e commit 54cd7f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. [](#improved)
* Vendor library updated to latest
* Improved `Session` initialization
* Added ability to set a `theme_var()` option in page frontmatter
1. [](#bugfix)
* Fixed issue with image alt tag always getting empted out unless set in markdown
* Fixed issue with remote PHP version determination for Grav updates [#1883](https://github.com/getgrav/grav/issues/1883)
Expand Down
4 changes: 3 additions & 1 deletion system/src/Grav/Common/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,9 @@ public function niceNumberFunc($n)
*/
public function themeVarFunc($var, $default = null)
{
return $this->config->get('theme.' . $var, $default);
$header = $this->grav['page']->header();
$header_classes = isset($header->$var) ? $header->$var : null;
return $header_classes ?: $this->config->get('theme.' . $var, $default);
}

/**
Expand Down

0 comments on commit 54cd7f8

Please sign in to comment.