Add per-form Listmonk list UUIDs to newsletter plugin
Add support for specifying Listmonk list UUIDs per form instance Update petition form to use metadata-defined UUIDs Add success confirmation message to newsletter forms Update documentation with new functionality
This commit is contained in:
parent
15a8f97cb2
commit
36591e7438
5 changed files with 47 additions and 17 deletions
|
|
@ -17,6 +17,7 @@ Then call from PHP content files:
|
|||
```php
|
||||
<?= newsletter_signup('Your custom intro text here', 'hero') ?>
|
||||
<?= newsletter_signup('Short text here', 'small') ?>
|
||||
<?= newsletter_signup('Text', 'small', ['list-uuid-1', 'list-uuid-2']) ?>
|
||||
```
|
||||
|
||||
## Themes
|
||||
|
|
@ -29,11 +30,12 @@ Then call from PHP content files:
|
|||
## Function Signature
|
||||
|
||||
```php
|
||||
newsletter_signup(string $introText, string $theme = 'hero', string $formId = 'newsletter'): string
|
||||
newsletter_signup(string $introText, string $theme = 'hero', array $listUuids = [], string $formId = 'newsletter'): string
|
||||
```
|
||||
|
||||
- `$introText` - Displayed above the form
|
||||
- `$theme` - `'hero'` or `'small'`
|
||||
- `$listUuids` - Listmonk list UUIDs for this form (empty = use global config)
|
||||
- `$formId` - HTML id for the section (for anchor links)
|
||||
|
||||
## How It Works
|
||||
|
|
@ -58,6 +60,8 @@ return [
|
|||
|
||||
Uses Listmonk's **public** subscription API (`/api/public/subscription`). No authentication needed. Listmonk handles its own double opt-in flow.
|
||||
|
||||
Per-form list UUIDs can be passed via `$listUuids` parameter. When empty, falls back to the global config's `list_uuids`.
|
||||
|
||||
## Anti-Spam
|
||||
|
||||
1. **CSRF token** - Separate from petition (`newsletter_csrf_token`)
|
||||
|
|
@ -71,7 +75,7 @@ All use `newsletter.*` prefix in language files:
|
|||
- `newsletter.email_label`, `newsletter.email_placeholder`
|
||||
- `newsletter.notice` (e.g., "We send about 12 emails per year")
|
||||
- `newsletter.submit_button`
|
||||
- `newsletter.success_message`, `newsletter.error_message`
|
||||
- `newsletter.success_message`, `newsletter.success_confirm`, `newsletter.error_message`
|
||||
|
||||
## Static Resources
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue