Skip to content

Commit

Permalink
Fixed #16474
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 21, 2025
1 parent 41b3000 commit e27a8b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 4

## Unreleased

- Fixed an error that occurred when referencing a single section entry by its handle. ([#16474](https://github.com/craftcms/cms/issues/16474))

## 4.14.0 - 2025-01-21

### Content Management
Expand Down
5 changes: 2 additions & 3 deletions src/web/twig/nodevisitors/SinglePreloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use craft\web\twig\nodes\PreloadSinglesNode;
use Twig\Environment;
use Twig\Node\BodyNode;
use Twig\Node\Expression\NameExpression;
use Twig\Node\Expression\Variable\ContextVariable;
use Twig\Node\MacroNode;
use Twig\Node\ModuleNode;
use Twig\Node\Node;
Expand Down Expand Up @@ -39,9 +39,8 @@ public function enterNode(Node $node, Environment $env): Node
array_unshift($this->_foundVariables, []);
} elseif (
!empty($this->_foundVariables) &&
get_class($node) === NameExpression::class &&
$node instanceof ContextVariable &&
$node->hasAttribute('name') &&
!$node->isSpecial() &&
!$node->getAttribute('always_defined') &&
(!$node->hasAttribute('spread') || !$node->getAttribute('spread'))
) {
Expand Down

0 comments on commit e27a8b7

Please sign in to comment.