# 配置主题组件设置中组的顺序

**URL:** <https://meta.discourse.org/t/configuring-the-order-of-groups-in-theme-component-settings/391101>\
**Category:** Development\
**Created:** [2025 年12 月 11 日 22:42 UTC](https://meta.discourse.org/t/configuring-the-order-of-groups-in-theme-component-settings/391101 "2025-12-11T22:42:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
发布日期： [2025 年12 月 11 日 22:42 UTC](https://meta.discourse.org/t/configuring-the-order-of-groups-in-theme-component-settings/391101/1 "2025-12-11T22:42:00Z")

</div>

我被要求提供一个选项，用于配置我的[组件](https://meta.discourse.org/t/messages-section-for-sidebar/389664)在侧边栏部分中添加的群组收件箱的顺序。现在我正在寻找一个优雅的解决方案，让管理员尽可能轻松地配置顺序。

我曾考虑过一个非常简单的对象类型设置。每个条目将包含一个群组选择器（通过 `groups` 设置类型），这比手动输入名称或 ID 要容易得多。然后可以使用上下箭头重新排序这些条目。

这是我所想的：

  

但实际上，它看起来更像这样：

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/a/9/da93109eb71ae3ce67eed510a2f279249d39e209.png)

群组下拉菜单本身工作正常。尽管设置存储的是群组 ID，但管理员在下拉菜单中看到的是群组的名称，因此选择正确的群组很容易。然而，当我使用 `group` 值作为对象条目的标识符时，UI 只显示群组 ID，而不是群组名称。这使得更改顺序变得困难，因为管理员将不得不依赖 ID 而不是名称。  
（另外，右侧有大量的空间，但“groups”仍然显示不正常。）

> **setting.yml**
>
> ```yaml
> group_inbox_order:
> type: objects
> default: []
> schema:
> name: entry
> identifier: group
> properties:
> group:
> type: groups
> required: true
> max: 1
> 
> ```

  

在上面的视频中，我为每个条目添加了一个额外的文本设置，我在其中手动输入了群组名称并将其用作标识符。但这感觉不是一个好的解决方案，因为显示的文本不再与实际的群组相关联，而且群组名称可能会更改。

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/b/3/ab317f1264f376f80a967697e0311a9e011f68cb.png)

> **setting.yml**
>
> ```yaml
> group_inbox_order:
> type: objects
> default: []
> schema:
> name: entry
> identifier: text
> properties:
> group:
> type: groups
> required: true
> max: 1
> text:
> type: string
> 
> ```

  

我也可以使用“group”类型的列表设置，但很难在那里重新排序项目，因为你只能删除它们然后重新添加。

有人有什么主意可以让我最好地解决这个问题吗？

---

_[View the full topic](https://meta.discourse.org/t/configuring-the-order-of-groups-in-theme-component-settings/391101)._
