Skip to content

Commit d8c4c8b

Browse files
committed
Fix conditions parser
1 parent 9f208d5 commit d8c4c8b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/AirBubble/Attributes/ConditionAttribute.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
namespace ElementaryFramework\AirBubble\Attributes;
3434

35+
use ElementaryFramework\AirBubble\Data\DataResolver;
3536
use ElementaryFramework\AirBubble\Util\EvalSandBox;
3637

3738
/**
@@ -55,10 +56,12 @@ class ConditionAttribute extends GenericAttribute
5556
/**
5657
* Evaluate the condition.
5758
*
59+
* @param DataResolver $resolver
60+
*
5861
* @return boolean
5962
*/
60-
public function evaluate(): bool
63+
public function evaluate(DataResolver $resolver): bool
6164
{
62-
return EvalSandBox::eval($this->getValue());
65+
return EvalSandBox::eval($this->getValue(), $resolver);
6366
}
6467
}

src/AirBubble/Tokens/ConditionToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function render(): ?\DOMNode
183183
foreach ($this->_conditionsMap as $path => $condition) {
184184
if ($condition instanceof ConditionAttribute) {
185185
$condition->parse();
186-
if ($condition->evaluate()) {
186+
if ($condition->evaluate($this->_template->getResolver())) {
187187
$truePath = $path;
188188
break;
189189
}

0 commit comments

Comments
 (0)