Advertisement
geminilabs

[site-reviews] add custom notification template tags

Aug 18th, 2023 (edited)
1,149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. /**
  2.  * @param array $data
  3.  * @param \GeminiLabs\SiteReviews\Modules\Email $email
  4.  * @return array
  5.  */
  6. add_filter('site-reviews/email/compose', function ($data, $email) {
  7.     if (!isset($email->data['review'])) {
  8.         return $data;
  9.     }
  10.     // Any custom field names added here will be available in your notifications templates:
  11.     // For example: A field name of 'custom_field_name' will be available as {{ custom_field_name }}
  12.     $customFieldNames = [
  13.         // 'custom_field_name',
  14.     ];
  15.     foreach ($customFieldNames as $tag) {
  16.         $data['template-tags'][$tag] = $email->data['review']->custom->get($tag);
  17.     }
  18.     return $data;
  19. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement