]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5953 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 26 May 2023 19:30:41 +0000 (21:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 26 May 2023 19:30:41 +0000 (21:30 +0200)
app/Fluidbook/Compiler/Links.php

index eda4c114fe90b75c68a5dec5061d8f9f3a71cd2b..b9524e944e3fbc519be9c08d3cb9cdd7bdc5412f 100644 (file)
@@ -323,7 +323,6 @@ trait Links
                     // Keep this line because some properties of the link (like blend mode) are parsed with this function
                     $c = $lta->getHTMLContainer();
 
-
                     $css[] = $lta->getCSSContainer();
                     if (!isset($pages[$lta->page])) {
                         $pages[$lta->page] = ['normal' => []];
@@ -360,7 +359,7 @@ trait Links
                 $this->config->afterSearchTooltip = $link->tooltip;
             }
 
-            if (strpos($link->page, 'link_') === 0) {
+            if (self::isLinkPage($link->page)) {
                 $linkPages[$link->page] = true;
             }
 
@@ -387,9 +386,13 @@ trait Links
         }
 
         foreach ($allpages as $i) {
-            $this->config->set('links.' . $i, $this->_htmlLinkList($pages[$i] ?? []));
-            $this->config->set('clinks.' . $i, $this->_htmlLinkList($cpages[$i] ?? []));
-            $this->config->set('ctlinks.' . $i, $this->_htmlLinkList($ctpages[$i] ?? []));
+            if (self::isLinkPage($i)) {
+                $this->config->set('links.' . $i, $this->_htmlLinkList(array_merge_recursive($pages[$i], $cpages[$i], $ctpages[$i])));
+            } else {
+                $this->config->set('links.' . $i, $this->_htmlLinkList($pages[$i] ?? []));
+                $this->config->set('clinks.' . $i, $this->_htmlLinkList($cpages[$i] ?? []));
+                $this->config->set('ctlinks.' . $i, $this->_htmlLinkList($ctpages[$i] ?? []));
+            }
         }
 
         if ($this->writeLinksData) {
@@ -400,6 +403,11 @@ trait Links
         return $css;
     }
 
+    protected static function isLinkPage($page)
+    {
+        return str_starts_with($page, 'link_');
+    }
+
     protected function addLinkLinks($link, $links, $assetsDimensions, &$linksToAdd)
     {
         if (isset($link['inline']) && $link['inline'] === 'popup') {