From 9f2ee1bee5ba45f023c57b74f1004d0caa57517b Mon Sep 17 00:00:00 2001 From: Pavel Golubev Date: Mon, 28 Jul 2025 14:08:17 +0300 Subject: [PATCH] Add categoryId condition in GetListElement processor In CMP or custom Resources sometimes need filter elements by categoryId in GetListElement Processor. --- core/src/Revolution/Processors/Element/GetList.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/Revolution/Processors/Element/GetList.php b/core/src/Revolution/Processors/Element/GetList.php index 164875202cb..42356dfbc71 100644 --- a/core/src/Revolution/Processors/Element/GetList.php +++ b/core/src/Revolution/Processors/Element/GetList.php @@ -37,13 +37,22 @@ public function prepareQueryAfterCount(xPDOQuery $c) $c->select([ 'category_name' => 'Category.category', ]); + $id = $this->getProperty('id', ''); + $categoryId = $this->getProperty('categoryId',''); + if (!empty($id)) { $c->where([ $c->getAlias() . '.id:IN' => is_string($id) ? explode(',', $id) : $id, ]); } + if (!empty($categoryId)) { + $c->where([ + 'Category.id:IN' => is_string($categoryId) ? explode(',', $categoryId) : $categoryId, + ]); + } + return $c; } }