angellco/fffields
Composer 安装命令:
composer require angellco/fffields
包简介
Fabulous front-end fields for Craft.
README 文档
README
Fabulous front-end fields for Craft to help you create front-end forms and dashboards.
Note: The license fee for this plugin is $59 via the Craft Plugin Store.
Requirements
This plugin requires Craft CMS 3.1.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require angellco/fffields -
In the Control Panel, go to Settings → Plugins and click the “Install” button for FFFields.
You can also install FFFields via the Plugin Store in your Craft control panel, look for the “Plugin store” link in the main navigation and then search “FFFields”.
FFFields Overview
FFFields gives you a complete toolkit to create fabulous front-end forms and dashboards. You can hook up your fields to Craft via the CraftQL plugin or roll your own solution.
This plugin makes use of Vue.js and Tailwind CSS, but you don’t need to know either to use it.
Here is an example form that allows users to submit job postings:
FFFields uses the fields you have already defined in Craft and handles the validation requirements you have set too.
Currently supported field types
- Plain Text
- URL
- Lightswitch
- Number
- Dropdown
- Radio Buttons
- Multi Select
- Checkboxes
Configuring FFFields
There is no configuration to get FFFields working on its own, but if you want to tie in with CraftQL then you need to do a few extra things.
-
Install the CraftQL plugin and setup up your endpoint and a token in the settings page.
-
Next, add the following environment variables to your
.envfile:FFF_GQL_ENDPOINT="https://my-craft-site.com/api" FFF_GQL_TOKEN="<token-from-craftql>" -
And finally, make sure to wrap your fields in the
{{ craft.fffields.formStart() }}and{{ craft.fffields.formEnd() }}tags as detailed in the usage section.
Using FFFields
To get started, output the following tag near the bottom of your page:
{{ craft.fffields.includeAssets() }}
This will include the various CSS and JS that is needed to run things.
If you don’t want to include the CSS, perhaps because you want to make your own Tailwind theme, then you can pass in false like so:
{{ craft.fffields.includeAssets(false) }}
Rendering fields
To render a field use the following method:
{{ craft.fffields.renderField('fieldHandle') }}
This method accepts a bunch of parameters as follows:
{{ craft.fffields.renderField(handle, {
value: null,
element: null,
required: false
}) }}
handle: this is required and should be a string- Options:
value: optional, defaults tonullelement: optional, if used it should be set to a valid Element and will override anyvaluealso set, defaults tonullrequired: optional, boolean, defaults tofalse
There is also another similar method for outputting special fields such as the title:
{{ craft.fffields.renderSpecial(handle, {
value: null,
element: null,
required: false
}) }}
The handle for this method should be one of the following supported list:
title- renders a standard Element Title field
Wrapping in a form
If you plan on using CraftQL to handle the form submissions then you can wrap your fields in the following two tags:
{{ craft.fffields.formStart(mutation, {
enabled: true,
redirect: null,
elementId: null,
submitText: null,
submittingText: null
}) }}
{{ craft.fffields.renderField() }}
...
{{ craft.fffields.formEnd() }}
The parameters for the formStart() method can be configured as follows:
mutation: required. Set this to the GraphQL mutation you want to use, e.g.upsertJobs.- Options:
enabled: optional, defaults totrue. Set this to false if you want to submit a disabled element.redirect: optional, defualts tonull. Set this to the path you want the user to be redirected to after a successful submission. Token substituion is supported so/jobs/edit/{id}would replace{id}with the ID value that is returned after submission. Currently supported tokens are{id},{slug}and{url}.elementId: optional, defualts tonull. Set this to the ID of the element you want to edit.submitText: optional, defaults to 'Save'. Use this to customise the submit button text.submittingText: optional, defaults to 'Saving …'. Use this to customise the disabled submit button text that is shown whilst the form data is sent.
FFFields Roadmap
General
- Release it
- Firm up the Vue Form API and document it
- Allow class overriding in Twig and Vue
- Build out the Vue-only API that fetches field config over XHR
- Add the ability generate full views from entry types
Special attributes
- Enabled / disabled
- Slug
- Post Date
- Expiry Date
- Author
- Parent
- All User attributes
Field types
- Matrix
- Date/Time
- Table
- Tags
- Entries
- Categories
- Users
- Assets
- Color
- Redactor
Support specific forms
These will need testing once the various special attributes for each form are added and then a full example for each can be documented.
- Login
- User Profile
- User Registration
- Forgot Password
- Set Password
Brought to you by Angell & Co
Big thanks to the following people and projects:
- Mark Huot, author of CraftQL
- The Vue.js project
- The Tailwind CSS project
angellco/fffields 适用场景与选型建议
angellco/fffields 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 48 次下载、GitHub Stars 达 11, 最近一次更新时间为 2019 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「fields」 「Craft」 「craftcms」 「craft-plugin」 「fffields」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 angellco/fffields 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 angellco/fffields 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 angellco/fffields 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Expand, collapse, change the status of, or delete multiple blocks in a Matrix field simultaneously.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Register advanced custom fields with object oriented PHP
Integrate with Snipcart.
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2019-02-13

