Specify condition methods
authorjoshuaruesweg <ruesweg@woltlab.com>
Tue, 31 Aug 2021 09:59:08 +0000 (11:59 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Tue, 31 Aug 2021 09:59:08 +0000 (11:59 +0200)
wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php
wcfsetup/install/files/lib/data/box/Box.class.php
wcfsetup/install/files/lib/system/box/BoxHandler.class.php

index 46ceef3b3476263848bd15a70ecfd28a7436651f..c5e6387671f174f507fbb777bf3851dac7792102 100644 (file)
@@ -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;
index 2d51e5b16e0d95f35a2e08a165b253ee215f4cf7..62204cdc63bd0f2f44b53347702be4dfa2ce8309 100644 (file)
@@ -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;
index cd67cbadc0921ebcdada2c56d02bb3771b23f59b..8b0bc02324b06a435ac44843b80695767dafa91d 100644 (file)
@@ -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;