amici/craft-super-dynamic-fields
Composer 安装命令:
composer require amici/craft-super-dynamic-fields
包简介
Use JSON templates as field options for dropdown, radio or checkboxes.
README 文档
README
Instead of adding key/values in field settings, You can now include any Craft CMS template where you can add JSON variable for options. If you have tons of fields with options and you dont want to add options in each field, this is best plugin for you. This field produce Checkboxes, Radio buttons, Select dropdown (single or multiple) selections. This fieldtype supports backend and frontend channel forms including normal fields, GRID and Fluid field types. Most important use is, As it comes from template, You can use any Craft CMS tags to generate options. This Addon just not stick with label and value fields for option. It gives you custom field support too. In the same JSON, you can pass any variables and fetch those variable at frontend with simple Craft CMS tags. Find more info on our docs.
Installation
Open your terminal and go to your Craft project:
cd /path/to/project
Run this command to load the plugin:
composer require amici/craft-super-dynamic-fields
In the Control Panel, go to Settings → Plugins and click the “Install” button for Super Dynamic Fields.
Usage
Create new field and select any of super dynamic field (Checkboxes, Radio or Dropdown) and scroll to the settings. You have to select JSON template you have added options of and that's it!
You have to follow proper JSON format to add options. There is 2 required JSON fields. i.e., "label" and "value". You can use "default" as "yes" to make any option as default selected. Example of JSON:
[
{"value" : "option1", "label" : "Option 1"},
{"value" : "option2", "label" : "Option 2", "default" : "yes"},
{"value" : "option3", "label" : "Option 3"},
]
"value", "label" and "default" is pre defined variables of JSON. You can also pass anything else in JSON that will become varibale custom field automatically.
[
{"label": "--" , "value" : "" , "default" : "yes", "link" : ""},
{"label": "Large" , "value" : "lg", "link" : "<a href='/abc'>Click Here</a>"},
{"label": "Medium" , "value" : "md", "link" : "<a href='/xyz'>Click Here</a>"}
]
// In this example, link is a custom field.
{% set entries = craft.entries.section("sectionName").limit(11).all() %}
[
{"label": "--" , "value" : "" , "default" : "yes", "url_title" : ""},
{% for item in entries %}
{"label": "{{ item.title }}" , "value" : "{{ item.getId() }}", "slug" : "{{ item.slug }}"}
{% if not loop.last %},{% endif %}
{% endfor %}
]
// In this example, slug is a custom field.
Template Code
You can get Value, Label and other custom fields from selected JSON options very easily.
For Singles like Dropdown and Radio Buttons:
// Render Value
{{ entry.myField }}
{{ entry.myField.getValue() }}
{{ entry.myField.value }}
// Render Label
{{ entry.myField.getLabel() }}
{{ entry.myField.label }}
// Render Extra fields:
// (extras will always be an array that have other fields from json option.)
{% set extras = entry.myField.getExtras() %}
{{ extras.field1 }}
{{ extras.field2 }}
For Multi like Checkboxes and Multi select fields:
{% for item in entry.myField %}
// Render Value
{{ item.myField }}
{{ item.myField.getValue() }}
{{ item.myField.value }}
// Render Label
{{ item.myField.getLabel() }}
{{ item.myField.label }}
// Render Extra fields:
// (extras will always be an array that have other fields from json option.)
{% set extras = item.myField.getExtras() %}
{{ extras.field1 }}
{{ extras.field2 }}
{% endfor %}
Documentation
Visit the Super Dynamic Fields for all documentation, guides, pricing and developer resources.
Support
Get in touch with us via the Amici Infotech Support or by creating a Github issue
amici/craft-super-dynamic-fields 适用场景与选型建议
amici/craft-super-dynamic-fields 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.32k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「json」 「options」 「dynamic」 「select」 「custom」 「checkboxes」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amici/craft-super-dynamic-fields 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amici/craft-super-dynamic-fields 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amici/craft-super-dynamic-fields 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Lightweight configuration interfaces and utilities
Flexslider slideshow content block for Silverstripe Elemental
Kinikit - PHP Application development framework MVC component
This extension provide application configuration support stored in database.
EAV modeling package for Eloquent and Laravel.
ext-json wrapper with sane defaults
统计信息
- 总下载量: 11.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2020-04-12