]> _ Git - fluidbook_tools.git/commitdiff
wip #5731
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 14 Feb 2023 16:32:32 +0000 (17:32 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 14 Feb 2023 16:32:32 +0000 (17:32 +0100)
src/Links/AnchorLink.php
src/Links/AudioLink.php
src/Links/HTMLMultimediaLink.php
src/Links/Link.php

index 1f73627cd1f53fe9e9876e822eb5997b6274802a..ffc375ed3229c13daf62c4da0f32099dab0b80d0 100644 (file)
@@ -8,7 +8,7 @@ class AnchorLink extends Link
 {
     protected $role = '';
 
-    public function getHTMLContainer()
+    protected function _getHTMLContainer()
     {
         $this->to = self::normalizeAnchor($this->to);
         $this->compiler->addPageLabel($this->page, $this->to);
index 121ee9a2bf41189b1308b92ffd9fd8261971a7ec..f2d0d594dfc51ac54585d58505ffd86b4398d5d3 100644 (file)
@@ -17,9 +17,9 @@ class AudioLink extends Link
         return self::makeAudioTag($this, $w, $h, $this->compiler);
     }
 
-    public function getCSSContainer()
+    protected function _getCSSContainer()
     {
-        $css = parent::getCSSContainer();
+        $css = parent::_getCSSContainer();
         $css .= '#l_' . $this->id . ' audio{';
         $css .= 'width:' . round($this->width * $this->getCssScale()) . 'px;';
         $css .= 'height:' . round($this->height * $this->getCssScale()) . 'px;';
index 35483a3bf61d3bdc78f2006722f335c2852fcf44..f15f9256eebc0664a6b9b185e140a64ee6027311 100644 (file)
@@ -138,7 +138,7 @@ class HTMLMultimediaLink extends Link
         }
     }
 
-    public function getCSSContainer()
+    protected function _getCSSContainer()
     {
         if ($this->moveOnEvenPage()) {
             $this->page--;
index f76c93a6dfce89ee2ae056d987903cb4a2633724..ba1d2a6d135ae632510a782d408941723db87136 100644 (file)
@@ -68,6 +68,9 @@ class Link {
 
     protected $_init;
 
+    protected $_cssContainer = null;
+    protected $_htmlContainer = null;
+
     /**
      *
      * @var CompilerInterface
@@ -428,7 +431,15 @@ class Link {
         return $this->infobulle;
     }
 
+
     public function getHTMLContainer() {
+        if (null === $this->_htmlContainer) {
+            $this->_htmlContainer = $this->_getHTMLContainer();
+        }
+        return $this->_htmlContainer;
+    }
+
+    protected function _getHTMLContainer() {
         $addContent = $this->getAdditionnalContent();
         return '<div class="' . $this->getHTMLContainerClass() . '" data-blendmode="' . $this->blendmode . '" data-hidden="' . $this->hidden . '" data-scorm="' . $this->scorm . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $addContent . '>' . $this->getHTMLContent() . '</div>';
     }
@@ -515,6 +526,13 @@ class Link {
     }
 
     public function getCSSContainer() {
+        if (null === $this->_cssContainer) {
+            $this->_cssContainer = $this->_getCSSContainer();
+        }
+        return $this->_cssContainer;
+    }
+
+    protected function _getCSSContainer() {
         if ($this->moveOnEvenPage()) {
             $this->page--;
             $this->left += $this->compiler->getWidth();