aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-08-16 13:34:24 +0200
committerThomas Lange <code@nerdmind.de>2017-08-16 13:34:24 +0200
commit2ad5b1537082257cfd8b26e6fb87380ec9b0ddea (patch)
tree963601ab905988231571714ba64d30671e57a752 /include/classes/BigPipe
parenta1cbe0aac7168967dc9a01fb22066d8a7c0176f2 (diff)
downloadbigpipe-2ad5b1537082257cfd8b26e6fb87380ec9b0ddea.tar.gz
bigpipe-2ad5b1537082257cfd8b26e6fb87380ec9b0ddea.tar.xz
bigpipe-2ad5b1537082257cfd8b26e6fb87380ec9b0ddea.zip
A new method called "setPlaceholderHTML" was implemented and can be used to display custom HTML content immediately while the pagelet is still processing.
Diffstat (limited to 'include/classes/BigPipe')
-rwxr-xr-xinclude/classes/BigPipe/Pagelet.php10
1 files changed, 9 insertions, 1 deletions
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;
#===============================================================================
@@ -125,11 +126,18 @@ class Pagelet extends Item {
}
#===============================================================================
+ # 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 .= "</{$this->tagname}>";
return $pageletHTML;