docs: Document entity token formatting with getFormattedTokens() method - #551
Conversation
|
@promptless-for-oss please rebase to 7.2 branch. |
76de697 to
b938b2f
Compare
|
@adiati98 Done — rebased onto One conflict on the |
|
@promptless-for-oss there are many unrelated, old commits here. Please clean rebase this to 7.2. |
b938b2f to
f75c0d9
Compare
adiati98
left a comment
There was a problem hiding this comment.
@promptless-for-oss please address the suggestions.
Documents BuilderTokenHelper::getFormattedTokens() and the TokenFormatOptions DTO for formatting entity-based tokens with category prefixes, including code examples, token sorting, and deprecation notices for addTokensFromHelper() and getTokensFromHelper() with migration guidance. Incorporates maintainer review feedback (Vale/style fixes) from PR mautic#551. Source PR mautic/mautic#15855 (merged into 7.x -> dev docs 7.2).
f75c0d9 to
cd8c731
Compare
adiati98
left a comment
There was a problem hiding this comment.
@promptless-for-oss please address the suggestions.
Documents BuilderTokenHelper::getFormattedTokens() and the TokenFormatOptions DTO for formatting entity-based tokens with category prefixes, including code examples, token sorting, and deprecation notices for addTokensFromHelper() and getTokensFromHelper() with migration guidance. Incorporates maintainer review feedback (Vale/style fixes) from PR mautic#551. Source PR mautic/mautic#15855 (merged into 7.x -> dev docs 7.2).
cd8c731 to
831fc1b
Compare
|
@adiati98 Done — thanks for the careful review.
Vale now reports 0 errors and 0 warnings on the changed file, and the PR is mergeable against |
patrykgruszka
left a comment
There was a problem hiding this comment.
Keep after reduction - the API documentation (getFormattedTokens, TokenFormatOptions, deprecations) is genuinely useful for plugin developers. The "Token sorting" list (lines 117–143) is accurate but is an implementation-inventory dump: the exact ordering and category labels are determined by TokenSorter constants and translation keys, and maintaining this list in prose adds maintenance burden with no user decision attached. Consider reducing that subsection to "Tokens are sorted by category (Contact, Company, Owner, …); custom tokens fall into an 'Other' group" and pointing readers to the TokenSorter source for the exact order.
Address maintainer @patrykgruszka's review on PR mautic#551: - Restore the 'alias' value column in the getFormattedTokens() migration example so migrated code keeps the same token keys as the deprecated addTokensFromHelper() call (5th arg defaults to 'id' otherwise). - Use the mautic.page.token.pagelink key ('Page link') in the linkWithId examples, matching core PageBundle\BuilderSubscriber, so the described prefix, key, and result label agree. - Reduce the Token sorting inventory list to a concise, non-exhaustive summary and point to the TokenSorter class constants as the authoritative order. Vale reports 0 errors and 0 warnings.
|
Thanks for the thorough review, @patrykgruszka — all three points are addressed and verified against the source PR (mautic/mautic#15855):
Vale passes with 0 errors and 0 warnings. PR #551 is updated and ready for another look. |
patrykgruszka
left a comment
There was a problem hiding this comment.
Automated review against the linked core PR (mautic/mautic#15855). One high-severity provenance issue found; everything else in the API documentation (getFormattedTokens, TokenFormatOptions, migration example) checks out against core code.
|
@promptless-for-oss apply suggestions |
|
Thanks @patrykgruszka — we're on it. We'll apply your review suggestions on this PR and push an update to the branch. |
|
Update: we've identified the two open items from your latest round — correcting the deprecation directive to |
… page' token category
|
Update: both items are applied and pushed to the branch — the deprecation directive now reads |
|
@patrykgruszka done — both items are applied and pushed to the branch:
Both changes were source-verified against mautic/mautic#15855, and Vale passes with 0 errors and 0 warnings. Ready for another look. |
|
Thanks @patrykgruszka — we're taking a look. Both of these items were just applied in the previous round, so we'll confirm the branch reflects them and follow up here. |
|
@patrykgruszka both of these are already addressed on the branch — they were applied in the previous round:
The current branch head ( |
|
Thanks @patrykgruszka — appreciate the review! 🙌 |
adiati98
left a comment
There was a problem hiding this comment.
@promptless-for-oss please address the suggestions.
|
Thanks @adiati98 — we are on it. We will apply the two suggested edits and revise the surrounding text to use active voice and drop 'will', then push an update to this PR. |
…abels - Deprecated methods: rewrite intro in active voice (Mautic as actor), remove 'will' - Token format options: wrap 'Form: Contact Form' and 'Page link: my-landing-page (456)' label examples in inline code (double backticks) per suggestion blocks
|
@adiati98 thanks for the review — we have addressed all three comments on the entity-token-formatting developer docs (PR #551):
Vale passes cleanly with 0 errors and 0 warnings, and the updated changes are pushed to this pull request for another look. One note: we tried to re-request your review programmatically but GitHub returned a 404 (the service account can't add a reviewer on this cross-fork PR). Would you mind re-triggering your review manually when you have a moment? The changes are visible in the new commit. |
adiati98
left a comment
There was a problem hiding this comment.
Thanks for the review, @patrykgruszka! 🚀
|
@all-contributors please add @patrykgruszka for review. |
|
I've put up a pull request to add @patrykgruszka! 🎉 |
Documents the
BuilderTokenHelper::getFormattedTokens()method andTokenFormatOptionsDTO for formatting entity-based tokens with category prefixes, including code examples, token sorting, and deprecation notices foraddTokensFromHelper()andgetTokensFromHelper()with migration guidance. Source PR mautic/mautic#15855 (merged into7.x, which maps to dev docs7.2).Latest revision — @adiati98 review round (2026-07-29)
All three review comments addressed on
docs/plugin_extensions/emails.rst:.. deprecated:: 7.2intro sentence from the passive "The followingBuilderEventmethods are deprecated and will be removed in a future version:" to the active "Mautic deprecates the followingBuilderEventmethods and removes them in a future version:". No removal version is asserted (source@deprecatedannotations carry none).Creates labels like 'Form: Contact Form':to inline code:Creates labels likeForm: Contact Form:.Creates labels like 'Page link: my-landing-page (456)' for linkable entities:to inline code:Creates labels likePage link: my-landing-page (456)for linkable entities:.Vale reports 0 errors and 0 warnings on the changed file.
Earlier revision — @patrykgruszka review round (2026-07-23)
Both items are source-verified against PR mautic/mautic#15855 (merge commit
118fd518a9) and applied:.. deprecated:: 7.0→.. deprecated:: 7.2. The merge commit first appears in tag7.2.0-rc(after7.0.0/7.0.1/7.0.2/7.1.0/7.1.1/7.1.2/7.1.3, verified withgit tag/describe --contains), matching the PR's7.2.0-rcmilestone. TheBuilderEvent.php@deprecateddocblock carries no version tag, so7.0was an incorrect inference.This pagebetweenAssetandEmailin the token-category list.TokenSorter.phpdefinesCATEGORY_THIS_PAGEat priority 80, betweenCATEGORY_ASSET(70) andCATEGORY_EMAIL(90); translationmautic.page.token.thispage= 'This page'. TheDynamic Contentlabel forCATEGORY_DWCis kept per the project style guide.Earlier revisions
Prior @patrykgruszka round (2026-07-22, all source-verified and applied): (1) restored the
'alias'value column in the migrationgetFormattedTokens()example so migrated code keeps the same token keys as the deprecatedaddTokensFromHelper()call; (2) switched thelinkWithId()examples to themautic.page.token.pagelinkkey ('Page link'), which corePageBundle\BuilderSubscriberactually uses, so the key, prefix, and result label agree; (3) reduced the Token-sorting inventory list to a concise, non-exhaustive summary pointing to theTokenSorterclass constants as the authoritative order.Also incorporates the earlier @adiati98 review rounds (Form/Contact FeatureList capitalization and
.. vale onplacement).