1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00

Update TemplateFile halt() method to optionally accept string argument to output before halt of template file rendering. For instance: return $this->halt('<h1>See ya</h2>'); from a template file.

This commit is contained in:
Ryan Cramer
2024-05-17 11:09:57 -04:00
parent 764153732e
commit faf27c8fa1

View File

@@ -609,14 +609,20 @@ class TemplateFile extends WireData {
* *
* USAGE from template file is: return $this->halt(); * USAGE from template file is: return $this->halt();
* *
* @param bool $halt * @param bool|string $halt
* If given boolean, it will set the halt status.
* If given string, it will be output (3.0.239+)
* @return $this * @return $this
* *
*/ */
protected function halt($halt = true) { public function halt($halt = true) {
$this->halt = $halt ? true : false; if(is_bool($halt)) {
$this->halt = $halt ? true : false;
} else if(is_string($halt)) {
$this->halt = true;
echo $halt;
}
return $this; return $this;
} }
} }