]> _ Git - fluidbook_tools.git/commitdiff
wait #7302 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Feb 2025 15:52:53 +0000 (16:52 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Feb 2025 15:52:53 +0000 (16:52 +0100)
src/Links/Link.php

index b5358a6cf74de04f675a3b2357f220dda15cce49..b9dde3ff907d43ec43e4364e788cfff2caedd0da 100644 (file)
@@ -133,6 +133,7 @@ class Link
     public $polygon = '';
     public $cursor = '';
     public $blinkdelay = 0;
+    public $stats = [];
     protected $role = 'button';
 
 
@@ -518,6 +519,15 @@ class Link
                     continue;
                 }
             }
+            if ($k === 'stats') {
+                $this->stats = static::parseExtras($v);
+                foreach ($this->stats as $k => $v) {
+                    if ($v === '$to') {
+                        $this->stats[$k] = $this->to;
+                    }
+                }
+                continue;
+            }
             $this->$k = $v;
         }
 
@@ -688,6 +698,9 @@ class Link
         if ($this->polygon) {
             $res .= 'data-polygon="' . e($this->polygon) . '" ';
         }
+        if ($this->stats) {
+            $res .= 'data-stats="' . htmlspecialchars(json_encode($this->stats), ENT_QUOTES) . '" ';
+        }
 
         return $res;