Skip to content

Commit

Permalink
fix: alfred tag showing up in markup when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 13, 2023
1 parent 2f0e1ee commit 5a152e7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ function (HookEvent $event) {
$html = str_replace("$key", $str, $html);
}
}

// add a fake edit tag to the page body
// this ensures that jQuery is loaded via PageFrontEdit
$faketag = "<div edit=title hidden>title</div>";
$html = str_replace("</body", "$faketag</body", $html);
}

$this->addTopBar($html);
Expand All @@ -254,12 +259,6 @@ function (HookEvent $event) {

// return replaced markup
$html = str_replace("</head>", "$assets</head>", $html);

// add a fake edit tag to the page body
// this ensures that jQuery is loaded via PageFrontEdit
$faketag = "<div edit=title hidden>title</div>";
$html = str_replace("</body", "$faketag</body", $html);

$event->return = $html;
}
);
Expand Down Expand Up @@ -1152,9 +1151,10 @@ public function livereload()
public function loadAlfred(): bool
{
if (!$this->hasAlfred) return false;
if ($this->wire->user->isSuperuser()) return true;
if ($this->wire->user->hasPermission(self::permission_alfred)) return true;
return false;
$permission = false;
if ($this->wire->user->isSuperuser()) $permission = true;
if ($this->wire->user->hasPermission(self::permission_alfred)) $permission = true;
return $permission and $this->hasAlfred;
}

/**
Expand Down

0 comments on commit 5a152e7

Please sign in to comment.