Skip to content

Commit

Permalink
Merge pull request #743 from brandonkelly/localized-fix
Browse files Browse the repository at this point in the history
Maintain ownerId from getLocalized()
  • Loading branch information
ttempleton authored May 21, 2023
2 parents 33b2b24 + 008378a commit 7232a30
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/elements/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ public function getCacheTags(): array
];
}

/**
* @inheritdoc
*/
public function getLocalized(): ElementQueryInterface|Collection
{
$query = parent::getLocalized();

if ($query instanceof BlockQuery && $this->ownerId !== null) {
// Maintain the same ownerId for queried blocks
$query->ownerId($this->ownerId);
}

return $query;
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit 7232a30

Please sign in to comment.