From ac4e09974ff06826f536596f14e8d73f9ae467c6 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Wed, 15 May 2024 13:26:26 +0800 Subject: [PATCH] * Modify entity list and story list. --- lib/zin/wg/entitylist/v1.php | 10 +++------- lib/zin/wg/storylist/v1.php | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/zin/wg/entitylist/v1.php b/lib/zin/wg/entitylist/v1.php index e37c6180bb..d51277d385 100644 --- a/lib/zin/wg/entitylist/v1.php +++ b/lib/zin/wg/entitylist/v1.php @@ -59,17 +59,13 @@ class entityList extends wg protected function getItems() { - global $lang; $items = $this->prop('items', array()); $list = array(); - foreach($items as $key => $entities) + foreach($items as $key => $entity) { - $list[] = array('id' => $key, 'title' => $lang->story->typeList[$key]); - foreach($entities as $entity) - { - $list[] = $this->getItem($entity); - } + if(is_string($entity)) $entity = (object)array('id' => $key, 'title' => $entity); + $list[] = $this->getItem($entity); } return $list; diff --git a/lib/zin/wg/storylist/v1.php b/lib/zin/wg/storylist/v1.php index e7574a842d..0fe94469c9 100644 --- a/lib/zin/wg/storylist/v1.php +++ b/lib/zin/wg/storylist/v1.php @@ -34,4 +34,29 @@ class storyList extends entitylist return $item; } + + protected function getItems() + { + global $lang; + $items = $this->prop('items', array()); + $list = array(); + + foreach($items as $key => $entity) + { + if(is_object($entity)) + { + $list[] = $this->getItem($entity); + } + elseif(is_array($entity)) + { + $list[] = array('id' => $key, 'title' => $lang->story->typeList[$key]); + foreach($entity as $subEntity) + { + $list[] = $this->getItem($subEntity); + } + } + } + + return $list; + } }