From 2ad5b1537082257cfd8b26e6fb87380ec9b0ddea Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 16 Aug 2017 13:34:24 +0200 Subject: A new method called "setPlaceholderHTML" was implemented and can be used to display custom HTML content immediately while the pagelet is still processing. --- include/classes/BigPipe/Pagelet.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/classes/BigPipe/Pagelet.php b/include/classes/BigPipe/Pagelet.php index 20e86a6..42ea470 100755 --- a/include/classes/BigPipe/Pagelet.php +++ b/include/classes/BigPipe/Pagelet.php @@ -14,6 +14,7 @@ class Pagelet extends Item { private $resources = []; private $dependencies = []; private $tagname = 'div'; + private $tagHTML = ''; private static $count = 0; #=============================================================================== @@ -124,12 +125,19 @@ class Pagelet extends Item { return $this->tagname = $tagname; } + #=============================================================================== + # Set custom placeholder HTML + #=============================================================================== + public function setPlaceholderHTML($HTML) { + return $this->tagHTML = $HTML; + } + #=============================================================================== # Magic method: __toString() #=============================================================================== public function __toString() { $pageletHTML = "<{$this->tagname} id=\"{$this->getID()}\">"; - $pageletHTML .= !BigPipe::enabled() ? $this->getHTML() : NULL; + $pageletHTML .= !BigPipe::enabled() ? $this->getHTML() : $this->tagHTML; $pageletHTML .= "tagname}>"; return $pageletHTML; -- cgit v1.2.3