diff --git a/application/Espo/Classes/TemplateHelpers/TableTag.php b/application/Espo/Classes/TemplateHelpers/TableTag.php
index a0c936f433..c6f98c5837 100644
--- a/application/Espo/Classes/TemplateHelpers/TableTag.php
+++ b/application/Espo/Classes/TemplateHelpers/TableTag.php
@@ -47,9 +47,13 @@ class TableTag implements Helper
$attributesPart .= " width=\"{$width}\"";
}
+ $function = $data->getFunction();
+
+ $content = $function !== null ? $function() : '';
+
return Result::createSafeString(
"
" .
- $data->getFunction()() .
+ $content .
"
"
);
}
diff --git a/application/Espo/Classes/TemplateHelpers/TdTag.php b/application/Espo/Classes/TemplateHelpers/TdTag.php
index 0682c7c139..571e9c721f 100644
--- a/application/Espo/Classes/TemplateHelpers/TdTag.php
+++ b/application/Espo/Classes/TemplateHelpers/TdTag.php
@@ -51,10 +51,12 @@ class TdTag implements Helper
$attributesPart .= " width=\"{$width}\"";
}
+ $function = $data->getFunction();
+
+ $content = $function !== null ? $function() : '';
+
return Result::createSafeString(
- "" .
- $data->getFunction()() .
- " | "
+ "" . $content . " | "
);
}
}
diff --git a/application/Espo/Classes/TemplateHelpers/TrTag.php b/application/Espo/Classes/TemplateHelpers/TrTag.php
index 3b33961865..926a655db4 100644
--- a/application/Espo/Classes/TemplateHelpers/TrTag.php
+++ b/application/Espo/Classes/TemplateHelpers/TrTag.php
@@ -37,10 +37,12 @@ class TrTag implements Helper
{
public function render(Data $data): Result
{
+ $function = $data->getFunction();
+
+ $content = $function !== null ? $function() : '';
+
return Result::createSafeString(
- "" .
- $data->getFunction()() .
- "
"
+ "" . $content . "
"
);
}
}
diff --git a/application/Espo/Core/Htmlizer/Helper/Data.php b/application/Espo/Core/Htmlizer/Helper/Data.php
index 7cbd7243ab..6fae463319 100644
--- a/application/Espo/Core/Htmlizer/Helper/Data.php
+++ b/application/Espo/Core/Htmlizer/Helper/Data.php
@@ -30,6 +30,7 @@
namespace Espo\Core\Htmlizer\Helper;
use stdClass;
+use Closure;
class Data
{
@@ -55,12 +56,12 @@ class Data
private $rootContext;
/**
- * @var ?callable
+ * @var ?Closure
*/
private $func = null;
/**
- * @var ?callable
+ * @var ?Closure
*/
private $inverseFunc = null;
@@ -77,8 +78,8 @@ class Data
array $context,
array $rootContext,
int $blockParams,
- ?callable $func,
- ?callable $inverseFunc
+ ?Closure $func,
+ ?Closure $inverseFunc
) {
$this->name = $name;
$this->argumentList = $argumentList;
@@ -137,12 +138,12 @@ class Data
return $this->options->$name ?? null;
}
- public function getFunction(): ?callable
+ public function getFunction(): ?Closure
{
return $this->func;
}
- public function getInverseFunction(): ?callable
+ public function getInverseFunction(): ?Closure
{
return $this->inverseFunc;
}