For the easiest integration, use the form-wrapper.php snippet. It handles everything for you, including:
<?php snippet('email-manager/form-wrapper'); ?>
This is the quickest way to set up a fully functioning email form.
For more control, you can separate the form display and the success message:
form.php to display the form.uccess-message.php to display a standalone success message.<?php
snippet('email-manager/form');
snippet('email-manager/success-message');
?>
You can choose whether or not to include session handling.
When using the Email Manager as a block, the plugin provides a default block snippet at blocks/email-manager.php, which automatically uses form-wrapper.php.
To create a custom block, you can override the block snippet and use the provided snippets (form.php and success-message.php) with or without session handling.
<?php snippet('email-manager/form', ['block' => $block]); ?>
<?php snippet('email-manager/success-message'); ?>
If you just want to add extra content around the form, you can use the wrapper in your custom block as well.
<?php snippet('email-manager/form-wrapper', ['block' => $block]); ?>
The Email Manager plugin uses session handling to display success messages after form submission. If you are implementing a custom solution or block, you can use the following session logic to manage success messages:
<?php
$session = kirby()->session();
$successMessage = $session->get('form.success');
if ($successMessage) {
$session->remove('form.success');
snippet('email-manager/success-message');
}
form.success.success-message.php.This logic can be used in any template, whether for a standalone solution or as part of a custom block.