Skip to content

Commit

Permalink
BUGFIX: Fixed issue where the virtualOwner would be set for every ele…
Browse files Browse the repository at this point in the history
…ment on a page
  • Loading branch information
UndefinedOffset committed Jun 1, 2023
1 parent 0a8e043 commit e8c3c06
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Extension/BaseElementExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@

class BaseElementExtension extends DataExtension
{
/**
* @var mixed
*/
protected $virtualOwner;

/**
* @config
*
Expand Down Expand Up @@ -60,7 +55,7 @@ public function populateDefaults()
*/
public function setVirtualOwner(ElementVirtual $owner)
{
$this->virtualOwner = $owner;
$this->owner->setField('_virtualOwner', $owner);
return $this;
}

Expand All @@ -69,7 +64,7 @@ public function setVirtualOwner(ElementVirtual $owner)
*/
public function getVirtualOwner()
{
return $this->virtualOwner;
return $this->owner->getField('_virtualOwner');
}

/**
Expand Down Expand Up @@ -240,7 +235,7 @@ public function getUsage()

if ($page = $this->owner->getPage()) {
$usage->push($page);
if ($this->virtualOwner) {
if ($this->owner->getField('_virtualOwner')) {
$page->setField('ElementType', 'Linked');
} else {
$page->setField('ElementType', 'Master');
Expand Down

0 comments on commit e8c3c06

Please sign in to comment.