Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Fixed issue where the VirtualOwner would be set for every element on a page #54

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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