What happened?
Description
After updating to Craft CMS 5.6, we noticed an issue where Single Entries used as Global are no longer available as expected within included templates. This issue was not present in Craft 5.5.
Here’s an example from our code:
<div class="logo item">
<a class="logo" href="{{ siteUrl }}" title="{{ gloSeo.seoSiteName }}">
{{ svg('@webroot/a/i/logo/logo' ~ logoStyle ~ '.svg') }}
</a>
</div>
After the update, the following error is thrown:
Twig\Error\RuntimeError: Variable "gloSeo" does not exist. in /path/to/templates/_includes/_baseParts/mainTopbar.twig:28
Additional Information:
• The issue occurs when these variables are used in templates included via mechanisms like {% include %}.
• Before updating to Craft 5.6, these variables were accessible without any problems.
• It seems that the global availability of Single Entries has been restricted by the update.
Steps to Reproduce:
- Create a Single Entry and use it as a global variable (e.g., for SEO information).
- Include this variable in a template that is embedded in a main template (e.g., using {% include %}).
- Try accessing the variable (e.g., {{ gloSeo.seoSiteName }}).
- After updating to Craft 5.6, the error occurs.
Expected Behavior:
Global variables defined by Single Entries should remain accessible in all templates, as they were in Craft 5.5.
Craft CMS version
5.6
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
After updating to Craft CMS 5.6, we noticed an issue where Single Entries used as Global are no longer available as expected within included templates. This issue was not present in Craft 5.5.
Here’s an example from our code:
After the update, the following error is thrown:
Additional Information:
• The issue occurs when these variables are used in templates included via mechanisms like {% include %}.
• Before updating to Craft 5.6, these variables were accessible without any problems.
• It seems that the global availability of Single Entries has been restricted by the update.
Steps to Reproduce:
Expected Behavior:
Global variables defined by Single Entries should remain accessible in all templates, as they were in Craft 5.5.
Craft CMS version
5.6
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions