eminos/statamic-field-item-relationship
Composer 安装命令:
composer require eminos/statamic-field-item-relationship
包简介
A Statamic addon that adds a Field Item Relationship fieldtype.
README 文档
README
A Statamic addon that adds a Field Item Relationship fieldtype. With Field Item Relationship you can select a value from a source field's items. That source field could be a sibling or ancestor field (in the same blueprint), or come from a Global set.
Installation
Install this addon using composer.
composer require eminos/statamic-field-item-relationship
Statamic support
| Statamic version | Addon version | Addon branch |
|---|---|---|
| Statamic 3-5 | 1.x |
1.x |
| Statamic 6 | 2.x |
main |
Features
- The source field could be a sibling or ancestor field, or come from a Global set.
- Set which key/field should be used as the select option label.
- Use string literal for advanced option label configuration.
- Choose what you want to save as the selected item.
- Key/Index
- Specified object key
- Full item/object
- Comes with a Tag
{{ fir }}to help you fetch the selected source field item.
Field configuration
The field configuration will depend on the source field data type. Depending on if the source data is a simple array of strings, an array of objects or an individual object, different "Save as" options will be possible.
You will get a warning message in the field if the field configuration isn't compatible with the source field data.
Tag usage
This fetches the source value from the configured source field in field "field_item_relationship_field".
{{ fir:field_item_relationship_field }}
If the source value is an object you get its values like this.
{{ fir:field_item_relationship_field }}
{{ text_field_1 }}
{{ some_other_field }}
{{ /fir:field_item_relationship_field }}
Or by specifying the target field in the tag like this:
{{ fir:field_item_relationship_field:text_field_1 }}
Even nested fields work, like this:
{{ fir:field_item_relationship_field:some_field.child_field }}
You can also get Global fields:
{{ fir:global_set:field_item_relationship_field:nested.target.path }}
Another way is to use the field and path parameters:
{{ fir field="global_set:field_item_relationship_field" path="some_field.child_field" }}
Screenshots
The field configuration options.

Possible improvements
- Multiselect
- More selection fieldtype options (in addition to the Select fieldtype)
- Support Assets fieldtype as source field.
License
The MIT License (MIT). Please see License File for more information.
eminos/statamic-field-item-relationship 适用场景与选型建议
eminos/statamic-field-item-relationship 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.67k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 09 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 eminos/statamic-field-item-relationship 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eminos/statamic-field-item-relationship 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-29
