-
-
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
[REF] Extract code used to render a pseudoconstant when a table is defined. #16902
Conversation
(Standard links)
|
824d1cb
to
ca7d6a0
Compare
$output = CRM_Utils_Array::asort($output); | ||
} | ||
} | ||
$output = self::renderOptionsFromTablePseudoconstant($pseudoconstant, $params, ($fieldSpec['localize_context'] ?? NULL), $context); |
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.
I assume the brackets are to tease @colemanw ? He he.
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.
Did you see he asked me to put brackets BACK IN in a PR today!
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.
I did. I admit I would have had to look up the precedence. I didn't, so I still don't know.
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.
I'll take the brackets over CRM_Utils_Array
any day!
The $params array gets changed in the original before being passed to the hook but then because there's no ampersand it doesn't get changed in the refactored function. Seems like it could be a problem? |
ca7d6a0
to
a2408f3
Compare
@demeritcowboy I have added the ampersand |
Maybe we should just always add an ampersand to function params just in case... 😁 |
aaarrrrghhhh |
CRM/Core/PseudoConstant.php
Outdated
// Localize results | ||
if (!empty($params['localize']) || $pseudoconstant['table'] === 'civicrm_country' || $pseudoconstant['table'] === 'civicrm_state_province') { | ||
$I18nParams = []; | ||
if ($localizeContent) { |
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 is a sneaky change but is ok. localizeContext
vs. localizeContent
. At least it has the proper 'z'. Yeah I said it. I can't hit people playing hockey anymore so this is as close as it gets to sport now.
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.
I flipped it back - your point
…fined. This permits us to re-use for settings
a2408f3
to
b53c346
Compare
test this please |
|
Test fail unrelated (conformance). Merging based on @demeritcowboy review |
Overview
Basic extraction in heavily tested code
This permits us to re-use for settings
Before
Code in one long function
After
Portion extracted out
Technical Details
Comments