-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Towards full metadata - fully declare 'bespoke' tokens #21713
Conversation
(Standard links)
|
0342988
to
b4c3292
Compare
b4c3292
to
e9841a5
Compare
I wonder about calculating these fields at the APIv4 level rather than in the token layer. For example, #21718 demonstrates how easy it is to add a calculated field to APIv4 which acts very much like a "real" field (you can use it in any clause - select, where, having, order by). |
@colemanw yeah - but not this round |
@colemanw longer answer - I have some real doubts about the validity of that participant balance token - but what would be REALLY useful is a similar token on the contribution side for balance - I had thought to add that if I can get far enough before the rc is cut. But for now I'm treating those tokens as ones we are stuck with |
protected function getBespokeTokens(): array { | ||
return [ | ||
'fee' => [ | ||
'title' => ts('Membership Fee'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we get to the point where the number formatting is settled I would deprecated this in favour of {membership.membership_type_id.minimum_fee}
if (array_key_exists('CiviCase', CRM_Core_Component::getEnabledComponents())) { | ||
$tokens['case_id'] = ts('Activity Case ID'); | ||
return [ | ||
'case_id' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This token exists because it was added in the past but there are 1-1 entity validilty issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, at best it could get you a case id (but no guarantee which one)
Ok let's merge this since it's
|
thanks @colemanw |
Overview
Towards full metadata - fully declare 'bespoke' tokens
The goal is to declare all tokens with full metadata and cache that - rather than the convoluted ways we have of looking up metadata - I'm working towards #21706 but working through roadblocks
Before
'bespokeTokens' (only in master) declared as a flat array
After
declared as a nuanced array
Technical Details
This functionality all has really good test cover. One thing it does change is that membership & event tokens start to advertise the
machine name tokens - the intent is to get to the point where ALL fields are declared as token metadata (which will be cached) but only those with 'audience' = 'user' will be in the widget - see #21706
Comments
@demeritcowboy @colemanw if you have a better function name that 'getBespokeFunctions` please speak now
variants on
custom
are too close to custom fields & calculated is not necessarily accurate.