Mailing - Support custom data in tokens - #36285
Conversation
Switches mailingTokens to extend CRM_Core_EntityTokens instead of the base class, to get the benefit of bulk prefetching and custom field support.
|
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
PR commands & links...
|
Supports api4-style custom data
01932c8 to
477218c
Compare
| class CRM_Mailing_Tokens extends \Civi\Token\AbstractTokenSubscriber { | ||
| class CRM_Mailing_Tokens extends CRM_Core_EntityTokens { | ||
|
|
||
| use \Civi\Token\Api4CustomTokenTrait; |
There was a problem hiding this comment.
I think the trait would be included directly in the EntityTokens rather than here.
There was a problem hiding this comment.
actually I don't even know I'd separate into a trait - it feels like part of the EntityTokens logic
There was a problem hiding this comment.
See comments here
civicrm-core/CRM/Core/EntityTokens.php
Lines 676 to 686 in 6f7023d
|
So yes - that looks about right - we already support
I think the rendering side of it might 'almost' work in civicrm-core/CRM/Core/EntityTokens.php Lines 676 to 686 in 6f7023d |
Overview
Building on #36280 this supports api4-style custom field tokens in mailings, including pseudoconstants like
{mailing.mailing_extra_info.priority_level:label}and joins to entity reference fields like{mailing.mailing_extra_info.assigned_author.display_name}For https://lab.civicrm.org/dev/core/-/work_items/6288
Open Questions