Skip to content

Commit

Permalink
Fix cascading data. Closes #1550
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Sep 4, 2020
1 parent 8fdc0c1 commit 6d36145
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/View/Antlers/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,15 @@ public function parseCallbackTags($text, $data)
}

if (! empty($values)) {
// parse the tag found with the value(s) related to it
$tmpname = md5($name);
$replacement = $this->parseVariables("{{ $tmpname }}$content{{ /$tmpname }}", [$tmpname => $values]);
if (Arr::isAssoc($values)) {
$replacement = $this->parse($content, array_merge($data, $values));
} else {
$values = $this->addLoopIterationVariables($values);
$replacement = collect($values)
->map(function ($value) use ($content, $data) {
return (string) $this->parse($content, array_merge($data, $value));
})->join('');
}
}
} else {
// nope, this must be a callback
Expand Down

3 comments on commit 6d36145

@acurrieclark
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just doing some research as to why, but this commit has broken some of my navs. It appears to be when I use the {{ depth }} tag in a {{ *recursive children* }} tag.
Release 3.0.3 is fine. 3.0.4 and 5 results in a Argument 1 passed to Illuminate\Support\Arr::isAssoc() must be of the type array, int given error.

@jasonvarga
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hang tight for next release: #2369

@acurrieclark
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jason

Please sign in to comment.