From: Matthias Schmidt Date: Fri, 7 May 2021 05:49:15 +0000 (+0200) Subject: Support form builder dependencies with non-Core templates X-Git-Tag: 5.4.0_Alpha_2~43 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=57a257fb88575c11e41abfe7e71772c2902f6830;p=GitHub%2FWoltLab%2FWCF.git Support form builder dependencies with non-Core templates --- 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); }