diff --git a/core/basepage.php b/core/basepage.php
index c644dfbd..2acdb953 100644
--- a/core/basepage.php
+++ b/core/basepage.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Shimmie2;
+use MicroHTML\HTMLElement;
+
require_once "core/event.php";
enum PageMode: string
@@ -604,7 +606,7 @@ class PageSubNavBuildingEvent extends Event
$this->parent= $parent;
}
- public function add_nav_link(string $name, Link $link, string $desc, ?bool $active = null, int $order = 50)
+ public function add_nav_link(string $name, Link $link, string|HTMLElement $desc, ?bool $active = null, int $order = 50)
{
$this->links[] = new NavLink($name, $link, $desc, $active, $order);
}
@@ -614,11 +616,11 @@ class NavLink
{
public string $name;
public Link $link;
- public string $description;
+ public string|HTMLElement $description;
public int $order;
public bool $active = false;
- public function __construct(String $name, Link $link, String $description, ?bool $active = null, int $order = 50)
+ public function __construct(string $name, Link $link, string|HTMLElement $description, ?bool $active = null, int $order = 50)
{
global $config;
diff --git a/ext/pm/main.php b/ext/pm/main.php
index 2d363aeb..1755e839 100644
--- a/ext/pm/main.php
+++ b/ext/pm/main.php
@@ -9,6 +9,8 @@ use GQLA\Field;
use GQLA\Query;
use GQLA\Mutation;
+use function MicroHTML\{emptyHTML, SPAN};
+
class SendPMEvent extends Event
{
public PM $pm;
@@ -185,8 +187,8 @@ class PrivMsg extends Extension
if ($event->parent==="user") {
if ($user->can(Permissions::READ_PM)) {
$count = $this->count_pms($user);
- $h_count = $count > 0 ? " ($count)" : "";
- $event->add_nav_link("pm", new Link('user#private-messages'), "Private Messages$h_count");
+ $h_count = $count > 0 ? SPAN(["class"=>'unread'], "($count)") : "";
+ $event->add_nav_link("pm", new Link('user#private-messages'), emptyHTML("Private Messages", $h_count));
}
}
}
@@ -196,8 +198,8 @@ class PrivMsg extends Extension
global $user;
if ($user->can(Permissions::READ_PM)) {
$count = $this->count_pms($user);
- $h_count = $count > 0 ? " ($count)" : "";
- $event->add_link("Private Messages$h_count", make_link("user", null, "private-messages"));
+ $h_count = $count > 0 ? SPAN(["class"=>'unread'], "($count)") : "";
+ $event->add_link(emptyHTML("Private Messages", $h_count), make_link("user", null, "private-messages"));
}
}
diff --git a/ext/user/events.php b/ext/user/events.php
index e93391af..aacf7fa1 100644
--- a/ext/user/events.php
+++ b/ext/user/events.php
@@ -4,11 +4,13 @@ declare(strict_types=1);
namespace Shimmie2;
+use MicroHTML\HTMLElement;
+
class UserBlockBuildingEvent extends Event
{
public array $parts = [];
- public function add_link(string $name, string $link, int $position=50): void
+ public function add_link(string|HTMLElement $name, string $link, int $position=50): void
{
while (isset($this->parts[$position])) {
$position++;