Skip to content

Commit 03e08ba

Browse files
committed
Merge branch 'release/1.0.0'
2 parents b214baf + 9be5fbc commit 03e08ba

13 files changed

+7855
-25
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: janhenckens

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: ci
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- develop
8+
permissions:
9+
contents: read
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
jobs:
14+
ci:
15+
name: ci
16+
uses: studioespresso/.github/.github/workflows/ci.yml@main
17+
with:
18+
craft_version: '5'
19+
jobs: '["ecs", "phpstan"]'
20+
secrets:
21+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

+56-15
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,71 @@
1-
# Buttondown
1+
# Buttondown for Craft CMS
2+
This plugin allow you to collect email addresses from your website and send them to your [Buttondown](https://buttondown.com/) newsletter.
23

3-
Buttondown integration
4+
Note that the plugin is not affiliated with Buttondown in any way - I personally use their service and wanted to create a plugin to make it easier to integrate with Craft CMS.
45

5-
## Requirements
6-
7-
This plugin requires Craft CMS 5.6.0 or later, and PHP 8.2 or later.
86

9-
## Installation
7+
![Screenshot](https://www.studioespresso.co/assets/buttondown-github-banner.png)
108

11-
You can install this plugin from the Plugin Store or with Composer.
129

13-
#### From the Plugin Store
10+
## Requirements
11+
This plugin requires Craft CMS 5.6.0 or later.
1412

15-
Go to the Plugin Store in your project’s Control Panel and search for “Buttondown”. Then press “Install”.
1613

17-
#### With Composer
14+
## Installation
15+
To install the plugin, follow these instructions.
1816

19-
Open your terminal and run the following commands:
17+
1. Open your terminal and go to your Craft project:
2018

2119
```bash
2220
# go to the project directory
23-
cd /path/to/my-project.test
21+
cd /path/to/my-craft-project.dev
2422

25-
# tell Composer to load the plugin
26-
composer require studioespresso/buttondown
23+
# tell Composer to install the plugin
24+
composer require studioespresso/craft-buttondown
2725

2826
# tell Craft to install the plugin
29-
./craft plugin/install craft-buttondown
27+
./craft install/plugin buttondown
3028
```
29+
30+
### Usage
31+
32+
The plugins needs an API key to connect to Buttondown. You can find your API key in your Buttondown account settings.
33+
34+
#### Basic subscriber form
35+
36+
In the simplest form, you only need an input called ``email``, you can post that to the ``buttondown/subscriber`` controller:
37+
````twig
38+
<form method="post">
39+
{{ csrfInput() }}
40+
{{ actionInput('buttondown/subscriber') }}
41+
{{ redirectInput('thanks-for-subscribing') }}
42+
43+
<label for="email-address">{{ "Email address"|t }}</label>
44+
<input id="email-address" name="email" type="email" autocomplete="email" required>
45+
46+
<button type="submit">{{ "Subscribe"|t }}</button>
47+
</form>
48+
````
49+
50+
#### Fields & tags
51+
52+
Buttondown makes it very easy to add custom fields and tags to subscribers, simply add them as ``fields`` or ``tags`` to the form like the example below:
53+
54+
````twig
55+
<form method="post">
56+
{{ csrfInput() }}
57+
{{ actionInput('buttondown/subscriber') }}
58+
{{ redirectInput('thanks-for-subscribing') }}
59+
60+
{# Add custom fields #}
61+
<label for="firstName" class="sr-only">{{ "First Name"|t }}</label>
62+
<input id="firstName" name="fields[firstName]" type="text" autocomplete="firstName">
63+
64+
<label for="email-address">{{ "Email address"|t }}</label>
65+
<input id="email-address" name="email" type="email" autocomplete="email" required>
66+
67+
{# Add tags, hidden or not #}
68+
<input type="hidden" name="tags[]" value="{{ siteName }}">
69+
<button type="submit">{{ "Subscribe"|t }}</button>
70+
</form>
71+
````

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"name": "studioespresso/buttondown",
2+
"name": "studioespresso/craft-buttondown",
33
"description": "Buttondown integration",
44
"type": "craft-plugin",
5+
"version": "1.0.0",
56
"license": "mit",
67
"support": {
78
"email": "[email protected]",
@@ -24,7 +25,7 @@
2425
}
2526
},
2627
"extra": {
27-
"handle": "craft-buttondown",
28+
"handle": "buttondown",
2829
"name": "Buttondown",
2930
"developer": "Studio Espresso",
3031
"documentationUrl": "https://github.com/studioespresso/craft-buttondown",
@@ -33,13 +34,12 @@
3334
"scripts": {
3435
"check-cs": "ecs check --ansi",
3536
"fix-cs": "ecs check --ansi --fix",
36-
"phpstan": "phpstan --memory-limit=1G"
37+
"phpstan": "phpstan --memory-limit=1G",
38+
"ci": "ecs check --ansi --fix && phpstan --memory-limit=1G"
39+
3740
},
3841
"config": {
3942
"sort-packages": true,
40-
"platform": {
41-
"php": "8.2"
42-
},
4343
"allow-plugins": {
4444
"yiisoft/yii2-composer": true,
4545
"craftcms/plugin-installer": true

0 commit comments

Comments
 (0)