Skip to content

TheDancingCode/grav-plugin-laposta

Repository files navigation

Laposta Plugin

The Laposta Plugin is an extension for Grav CMS that adds a Laposta subscription action to your forms.

Installation

Installing the Laposta plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.

GPM Installation (Preferred)

To install the plugin via the GPM, through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:

bin/gpm install laposta

This will install the Laposta plugin into your /user/plugins-directory within Grav. Its files can be found under /your/site/grav/user/plugins/laposta.

Manual Installation

To install the plugin manually, download the zip-version of this repository and unzip it under /your/site/grav/user/plugins. Then rename the folder to laposta. You can find these files on GitHub or via GetGrav.org.

You should now have all the plugin files under

/your/site/grav/user/plugins/laposta

NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its blueprints.yaml-file on GitHub.

Admin Plugin

If you use the Admin Plugin, you can install the plugin directly by browsing the Plugins-menu and clicking on the Add button.

Configuration

Before configuring this plugin, you should copy the user/plugins/laposta/laposta.yaml to user/config/plugins/laposta.yaml and only edit that copy.

Note that if you use the Admin Plugin, a file with your configuration named laposta.yaml will be saved in the user/config/plugins/-folder once the configuration is saved in the Admin.

Here is the default configuration and an explanation of available options:

enabled: true
api_key:
default_list_id:

api_key

Your Laposta API key. Can be found in your dashboard.

default_list_id

The ID of the list subscribers will be added to by default, when no list is specified in the form definition. Your list ID's can be found in your dashboard.

Usage

Setup a form with the laposta action:

form:
  name: subscribe
  fields:
    firstname:
      label: First name
      type: text
    surname:
      label: Surname
      type: text
    email:
      label: Email
      type: email
      validate:
        required: true
  buttons:
    submit:
      type: submit
      value: Subscribe
  process:
    - ip: true
    - laposta: true
    - message: Thank you for subscribing!

Add any fields from your Laposta list, but make sure to use the names as defined in your dashboard.

It is important that the ip action is enabled.

You can define a list ID in the laposta action if you wish to override the default list:

process:
  - ip: true
  - laposta:
      list_id: xxxxxxxx
  - message: Thank you for subscribing!

About

Adds a Laposta subscription action to your Grav CMS forms

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages