Skip to content

Commit

Permalink
don't freak out if the owner is new for site (still provisional draft)
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Nov 18, 2024
1 parent ca57c60 commit 1116217
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/base/NestedElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ public function getPrimaryOwner(): ?ElementInterface
return null;
}

$this->_primaryOwner = Craft::$app->getElements()->getElementById($primaryOwnerId, null, $this->siteId, [
$this->_primaryOwner = Craft::$app->getElements()->getElementById($primaryOwnerId, null, null, [
'trashed' => null,
'preferSites' => [$this->siteId],
]) ?? false;
if (!$this->_primaryOwner) {
throw new InvalidConfigException("Invalid owner ID: $primaryOwnerId");
Expand Down

0 comments on commit 1116217

Please sign in to comment.