1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +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();
*
* @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
*
*/
protected function halt($halt = true) {
public function halt($halt = true) {
if(is_bool($halt)) {
$this->halt = $halt ? true : false;
} else if(is_string($halt)) {
$this->halt = true;
echo $halt;
}
return $this;
}
}