From 57a257fb88575c11e41abfe7e71772c2902f6830 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 7 May 2021 07:49:15 +0200 Subject: [PATCH] Support form builder dependencies with non-Core templates --- .../AbstractFormFieldDependency.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php index 7e4844d168..213af182a6 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/AbstractFormFieldDependency.class.php @@ -2,6 +2,7 @@ namespace wcf\system\form\builder\field\dependency; +use wcf\system\application\ApplicationHandler; use wcf\system\form\builder\field\IFormField; use wcf\system\form\builder\IFormNode; use wcf\system\WCF; @@ -47,6 +48,13 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency */ protected $templateName; + /** + * abbreviation of the application the template belongs to + * @var string + * @since 5.4 + */ + protected $templateNameApplication = 'wcf'; + /** * @inheritDoc */ @@ -133,8 +141,11 @@ abstract class AbstractFormFieldDependency implements IFormFieldDependency if ($this->templateName === null) { throw new \LogicException("Template name is not set."); } + if (ApplicationHandler::getInstance()->getApplication($this->templateNameApplication) === null) { + throw new \LogicException("Unknown application with abbreviation '{$this->templateNameApplication}'."); + } - return WCF::getTPL()->fetch($this->templateName, 'wcf', [ + return WCF::getTPL()->fetch($this->templateName, $this->templateNameApplication, [ 'dependency' => $this, ], true); } -- 2.20.1