From: joshuaruesweg Date: Tue, 31 Aug 2021 09:59:08 +0000 (+0200) Subject: Specify condition methods X-Git-Tag: 5.5.0_Alpha_1~456^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15053941278c90bd9bafa7c1fb01433d06e4cf8f;p=GitHub%2FWoltLab%2FWCF.git Specify condition methods --- diff --git a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php index 46ceef3b34..c5e6387671 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php @@ -180,7 +180,7 @@ class BoxEditForm extends BoxAddForm ConditionHandler::getInstance()->updateConditions( $this->box->boxID, - $this->box->getConditions2(), + $this->box->getVisibilityConditions(), $conditions ); @@ -258,7 +258,7 @@ class BoxEditForm extends BoxAddForm $this->readBoxImages(); - $conditions = $this->box->getConditions2(); + $conditions = $this->box->getVisibilityConditions(); $conditionsByObjectTypeID = []; foreach ($conditions as $condition) { $conditionsByObjectTypeID[$condition->objectTypeID] = $condition; diff --git a/wcfsetup/install/files/lib/data/box/Box.class.php b/wcfsetup/install/files/lib/data/box/Box.class.php index 2d51e5b16e..62204cdc63 100644 --- a/wcfsetup/install/files/lib/data/box/Box.class.php +++ b/wcfsetup/install/files/lib/data/box/Box.class.php @@ -530,11 +530,24 @@ class Box extends DatabaseObject } /** - * Returns the conditions of the notice. + * Returns the conditions for the box controller. * * @return Condition[] + * @deprecated since 5.5 - use self::getControllerConditions() instead */ public function getConditions() + { + return $this->getControllerConditions(); + } + + /** + * Returns the conditions for the box controller. + * The conditions are intended for the contents of the box. + * + * @return Condition[] + * @since 5.5 + */ + public function getControllerConditions() { /** @noinspection PhpUndefinedMethodInspection */ if ($this->boxType === 'system' && $this->getController() instanceof IConditionBoxController && $this->getController()->getConditionDefinition()) { @@ -549,12 +562,12 @@ class Box extends DatabaseObject } /** - * @TODO + * Returns the conditions for the visibility of the box. * * @return Condition[] * @since 5.5 */ - public function getConditions2(): array // @TODO name + public function getVisibilityConditions(): array { return ConditionHandler::getInstance()->getConditions( 'com.woltlab.wcf.condition.box', // @TODO make const @@ -564,7 +577,7 @@ class Box extends DatabaseObject public function isVisible(): bool { - $conditions = $this->getConditions2(); + $conditions = $this->getVisibilityConditions(); foreach ($conditions as $condition) { if (!$condition->getObjectType()->getProcessor()->showContent($condition)) { return false; diff --git a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php index cd67cbadc0..8b0bc02324 100644 --- a/wcfsetup/install/files/lib/system/box/BoxHandler.class.php +++ b/wcfsetup/install/files/lib/system/box/BoxHandler.class.php @@ -195,7 +195,7 @@ class BoxHandler extends SingletonFactory 'com.woltlab.wcf.page' ); $oldCondition = []; - foreach ($box->getConditions2() as $condition) { + foreach ($box->getVisibilityConditions() as $condition) { if ($condition->objectTypeID === $conditionObjectTypeID) { $oldCondition[] = $condition; break;