Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Classes/Finishers/BrevoFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function addEntryToBrevo(): bool
{
try {
$apiInstance = $this->getApi();
if ($this->extensionConfiguration->isDoi()) {
if ($this->isDoiEnabled()) {
$createContact = new CreateDoiContact();
$createContact
->setEmail($this->parseOption('email'))
Expand Down Expand Up @@ -142,6 +142,24 @@ protected function getEnrichedListIds(): array
return array_unique($lists);
}

/**
* Check if DOI is enabled.
* By default, DOI is enabled via the extension configuration.
* Optionally, it can be disabled via the form configuration.
*
* @return bool
*/
protected function isDoiEnabled(): bool
{
$doiEnabled = $this->extensionConfiguration->isDoi();

if ($this->parseOption('doi') !== null) {
$doiEnabled = (bool)$this->parseOption('doi');
}

return $doiEnabled;
}

/**
* @return object
*/
Expand Down
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Head over to the extension configuration and provide all settings you need:
- *Partner Key*: currently not in use
- Default Lists*: Add IDs of brevo contact lists which are added to every contact
- **DOI**
- *Enable double optin*: Please always use double opt in!
- *Enable double optin*: Please always use double opt in! Additionally, it can be overwritten by form configuration.
- *Page ID for redirect*: Page which a user is sent to after confirming double opt in
- *DOI Template*: Id of brevo template which is used for DOI mails.
- **Attributes**
Expand Down Expand Up @@ -67,6 +67,7 @@ The following configurations can be used to override the global settings
options:
doiTemplateId: '14'
defaultListIds: '12,34'
doi: false
identifier: Brevo
```

Expand Down
1 change: 1 addition & 0 deletions Resources/Private/Example/brevo-example.form.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ finishers:
# override global settings
# doiTemplateId: '14'
# defaultListIds: '12,34'
# doi: false
identifier: Brevo
-
options:
Expand Down