Skip to content

Commit

Permalink
recursive loop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-jennings authored Oct 23, 2017
1 parent b78b059 commit 90d319f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Models/BlockRepeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ public static function addChildBlockIds($blockIds)
foreach ($blockIds as $blockId) {
$blockRepeater = static::preload($blockId);
if ($blockRepeater->exists) {
$blockRepeaterChildren = explode(',', $blockRepeater->blocks);
if (($key = array_search($blockId, $blockRepeaterChildren)) !== false) {
unset($blockRepeaterChildren[$key]);
}
$blockRepeaterBlockIds = array_merge(
$blockRepeaterBlockIds,
static::addChildBlockIds(explode(',', $blockRepeater->blocks)),
static::addChildBlockIds($blockRepeaterChildren),
[$blockId]
);
}
Expand Down

0 comments on commit 90d319f

Please sign in to comment.