如何从 October CMS 自定义插件中的复选框列表中获取值

How to get value from checkbox list in October CMS custom plugin

我在我的插件数据库 table 中输入了 project_toolbox 并创建了包含 10 个值的名为 project_toolbox 的复选框列表。如果从后端检查,我如何检索这些值。

这里是我无法获取复选框值的值

<div class="project-toolbox">
{% for toolbox in project.project_toolbox %}
    <div class="{{ option.name }}"><span>{{ toolbox.name }} Hello</span></div>
{% endfor %}
</div>

您可以简单地遍历数组

<div class="project-toolbox">
{% for toolbox_item in project.project_toolbox %}
    <div class="{{ option.name }}"><span>{{ toolbox_item }} Hello</span></div>
{% endfor %}
</div>

You can directly use string value {{ toolbox_item }} as project_toolbox is the array of strings.

如有疑问请评论。