Add UIBlocks to twig (Add... methods can be called by specifying their name in the parameters)

This commit is contained in:
Eric
2021-01-22 17:16:56 +01:00
parent 2d93879e7a
commit 3d29a1e894

View File

@@ -107,11 +107,13 @@ class UIBlockNode extends Node
$oRefClass = new ReflectionClass($this->sBlockClass);
$aMethods = $oRefClass->getMethods(ReflectionMethod::IS_PUBLIC);
foreach ($aMethods as $oMethod) {
if (!$oMethod->isStatic() && utils::StartsWith($oMethod->getName(), 'Set')) {
$aSetters[] = substr($oMethod->getName(), 3); // remove 'Set' to get the variable name
}
if (!$oMethod->isStatic() && utils::StartsWith($oMethod->getName(), 'Add')) {
$aAdders[] = $oMethod->getName();
if (!$oMethod->isStatic() && $oMethod->getNumberOfParameters() == 1) {
if (utils::StartsWith($oMethod->getName(), 'Set')) {
$aSetters[] = substr($oMethod->getName(), 3); // remove 'Set' to get the variable name
}
if (utils::StartsWith($oMethod->getName(), 'Add')) {
$aAdders[] = $oMethod->getName();
}
}
}
if (!empty($aSetters)) {