-
-
Notifications
You must be signed in to change notification settings - Fork 824
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 getFormValues #18510
[Ref] Extract getFormValues #18510
Conversation
(Standard links)
|
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams); | ||
$session = CRM_Core_Session::singleton(); | ||
$session->replaceUserContext($url); | ||
|
||
$cacheKey = "civicrm search {$qfKey}"; |
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.
Actually this move is just to make cleaning up the url part easier
b38b983
to
3840ca7
Compare
Digging into this is seems the is always an object that inherits from this class It is called statically primarily because the export task does not have subclasses per form & does not know what variant it's passing in. However, we can move functions onto the CRM_Contact_Form_Task class as non-static functions and call them form form-> however unintuitive that seems. I am trying to clean up the structure such that we can move on from the static method but decided I should tackle this function a little first. To test try doing an export from any search & this is called in static mode (same goes for any task but the path is less ambiguous)
3840ca7
to
986ac53
Compare
test this please |
@colemanw this should be an easy extraction |
@@ -88,7 +88,7 @@ public static function preProcessCommon(&$form) { | |||
|
|||
$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath); | |||
if ($isStandAlone) { | |||
list($form->_task, $title) = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form)); | |||
[$form->_task, $title] = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form)); |
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.
Cool. I didn't know about the square bracket shortcut for list()
. Learn something new every day around here...
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.
yeah phpstorm keeps making that change on me :-)
@colemanw was this OK to merge |
Overview
Extract getFormValues on task preProcessCommmon
Before
Long chunk
After
Extracted function
Technical Details
Digging into this is seems the is always an object that inherits from this class
It is called statically primarily because the export task does not have
subclasses per form & does not know what variant it's passing in. However, we can
move functions onto the CRM_Contact_Form_Task class as non-static functions
and call them form form-> however unintuitive that seems.
I am trying to clean up the structure such that we can move on from the
static method but decided I should tackle this function a little first.
To test try doing an export from any search & this is called in static mode
(same goes for any task but the path is less ambiguous)
Comments