Skip to content
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

[REF] Extract function to getDomainTokens #21416

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 9, 2021

Overview

[REF] Extract function to getDomainTokens

Before

The caching & code for replace domain tokens is just weird

After

A cached array is returned.....

Technical Details

Test cover in BAO_MessageTemplateTest.testDomainTokens

This caches the whole token set by domain+locale+html rather than just part.

Open questions

  1. where should this go - on the BAO_Domain class?
    Or on a token processor class (eventually it would only be
    called from a token processor class)
  2. does it make sense to pass $html in - I left it there for now but I think the token processor would expect to handle that itself

Comments

@civibot
Copy link

civibot bot commented Sep 9, 2021

(Standard links)

@civibot civibot bot added the master label Sep 9, 2021
$domain = CRM_Core_BAO_Domain::getDomain();
}
else {
$domain = new CRM_Core_BAO_Domain();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly - we are being pretty coy not just loading it in the first place but maybe it will save a query...

This caches the whole token set by domain+locale+html rather than just part.

I am thinking about where this should do - on the BAO_Domain class?
Or on a token processor class (eventually it would only be
called from a token processor class)

Test cover in 'BAO_MessageTemplateTest.testDomainTokens'
@seamuslee001
Copy link
Contributor

This works for me

@seamuslee001 seamuslee001 merged commit 137020e into civicrm:master Sep 10, 2021
@seamuslee001 seamuslee001 deleted the dom_toke branch September 10, 2021 00:37
@eileenmcnaughton
Copy link
Contributor Author

thanks @seamuslee001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants