Skip to content

Commit

Permalink
Accept Mosaico-style mailing-address for validation
Browse files Browse the repository at this point in the history
Before
------
CiviMail generally requires `{domain.address}`. This is not provided
by default in most Mosaico templates. However, the Mosaico templates
do provide a block where you're expected to fill in the address.

After
-----
The `{domain.address}` is not required for Mosaico mailings.
  • Loading branch information
totten committed Nov 25, 2017
1 parent fd3d797 commit 6638959
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CRM/Mosaico/MosaicoRequiredTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,22 @@ public function __construct() {
}

public function getRequiredTokens() {
return Civi::service('civi_flexmailer_required_tokens')
$requiredTokens = Civi::service('civi_flexmailer_required_tokens')
->getRequiredTokens();

// Mosaico's templates handle the mailing-address/contact-info
// differently than the CiviMail templates -- one of the standard
// blocks provides a section where it prompts you to fill in this info.
//
// Arguably, this makes the `{domain.address}` requirement redundant.
// Arguably, the `{domain.address}` approach is better.
//
// For the moment, it's convenient to go along with the Mosaico-way.
// But it's quite patch-welcome to change (eg inject `{domain.address}`
// to the default layout, and then enforce the requirement).
unset($requiredTokens['domain.address']);

return $requiredTokens;
}

public function findMissingTokens($str) {
Expand Down

0 comments on commit 6638959

Please sign in to comment.