swordfox/campaign-monitor-userform 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

swordfox/campaign-monitor-userform

最新稳定版本:2.0.1

Composer 安装命令:

composer require swordfox/campaign-monitor-userform

包简介

Custom Userform Field which integrates with Campaign Monitor

README 文档

README

Adds a custom field to UserForms which allows you to select a list from campaign monitor, set custom fields and subscribe on submission.

Thank to mylesthedev for the original SilverStripe 3 version.

Installation

Via composer

composer require swordfox/campaign-monitor-userform
Configuration

To connect to your campaign monitor field you will need to set two fields in your campaign-monitor-userform.yml.

Swordfox\UserForms\EditableCampaignMonitorField:
    api_key: 'API KEY GOES HERE'
    client_id: 'CLIENT ID GOES HERE'

^ These setting can be found in client settings area in Campaign Monitor.

Customisation

You can also change what type of field is actually used on the UserForm. By Default it's a checkbox field. You can change this via your config.yml OR via the CMS per form. If you choose to use a DropdownField you can add options under the Custom Options tab.

Swordfox\UserForms\EditableCampaignMonitorField:
    defaultFieldType: 'DropdownField'
Adding Custom Fields

You can integrate your campaigns custom fields with the fields on your form. To do so you must name the field(s) with the prefix 'customfields_', so for example if your custom field was called interests then the field name on your form must be named customfield_interests. The module will automatically push all fields to Campaign Monitor if there's a match. Note: there are a few caveats here e.g. you have to ensure if a field is required then it needs to be required at both ends.

Extensions

There are a few extension hooks which can be useful to handle data before and after saving throughout the process.

  • $this->extend('beforeValueFromData', $data)
  • $this->extend('afterValueFromData', $data)
  • $this->extend('updateLists', $data)
  • $this->extend('updateCustomFields', $custom_fields)

Field configuration example

统计信息

  • 总下载量: 42
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-07-22