From 3a22f35591e6a4b6c6429f855785f0904e9eee33 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 31 Jul 2024 15:26:18 +0800 Subject: [PATCH] [misc] rebuildFieldSetting when preview a pivot. --- module/pivot/model.php | 9 +++++---- module/pivot/zen.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/module/pivot/model.php b/module/pivot/model.php index 83adce9113..466cb402b5 100644 --- a/module/pivot/model.php +++ b/module/pivot/model.php @@ -34,7 +34,7 @@ class pivotModel extends model * @access public * @return object|bool */ - public function getByID(int $pivotID, bool $processDateVar = false): object|bool + public function getByID(int $pivotID, bool $processDateVar = true, $isPreview = false): object|bool { $pivot = $this->dao->select('*')->from(TABLE_PIVOT) ->where('id')->eq($pivotID) @@ -58,7 +58,10 @@ class pivotModel extends model $pivot->filters = $pivotFilters; - return $this->processPivot($pivot); + $pivot = $this->processPivot($pivot); + if($isPreview && isset($pivot->stage) && $pivot->stage == 'published') $this->processFieldSettings($pivot); + + return $pivot; } /** @@ -105,8 +108,6 @@ class pivotModel extends model if($isObject) $this->addDrills($pivot); } - // if($isObject && isset($pivot->stage) && $pivot->stage == 'published') $this->processFieldSettings($pivot); - return $isObject ? $pivot : $pivots; } diff --git a/module/pivot/zen.php b/module/pivot/zen.php index 157c4ed5c3..b42c3cbe48 100644 --- a/module/pivot/zen.php +++ b/module/pivot/zen.php @@ -152,7 +152,7 @@ class pivotZen extends pivot */ public function show(int $groupID, int $pivotID): void { - $pivot = $this->pivot->getByID($pivotID); + $pivot = $this->pivot->getByID($pivotID, true, true); $driver = $pivot->driver; if(isset($_POST['filterValues']) and $_POST['filterValues']) {