-
-
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
Update signature for searchKitTasks hook for civiimport #25232
Conversation
(Standard links)
|
@@ -212,7 +212,7 @@ function civiimport_civicrm_alterTemplateFile($formName, $form, $type, &$templat | |||
* | |||
* @noinspection PhpUnused | |||
*/ | |||
function civiimport_civicrm_searchKitTasks(array &$tasks, bool $checkPermissions, ?int $userId) { | |||
function civiimport_civicrm_searchKitTasks(array &$tasks, bool $checkPermissions, ?int $userID, ?array $search = [], ?array $display = []) { |
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 not required for the fix. But it makes sense to update the signature at the same time..
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.
@mattwire do we need to allow for NULL - you are adding a default so if not passed it will be []
& since these params are new there should be no cases of NULL actively being passed in
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 don't think so. It should either be unset or an array. The only edge case - but it doesn't get as far as the hook - is the other bit I'm fixing in this PR where the name is passed in as a string before being "expanded" into the array.
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.
@mattwire so we can change to just array $search = []
rather than ?array $search = []
?
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.
@eileenmcnaughton Yep, updated. I've rebased this PR so it's just a signature update 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.
Also, turns out is does need the ?array
because it can be NULL
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.
@mattwire yeah - I just think we should convert it to an array before sending off to the hook - rather than this loosey goosey 'could be this could be that' approach
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.
@eileenmcnaughton they way this hook is called from different contexts, there's no way around the fact that sometimes those variables are set and sometimes they are not. However they will always be passed in, even if NULL
, so @mattwire what I'd like to do with this PR is this:
function civiimport_civicrm_searchKitTasks(array &$tasks, bool $checkPermissions, ?int $userID, ?array $search = [], ?array $display = []) { | |
function civiimport_civicrm_searchKitTasks(array &$tasks, bool $checkPermissions, ?int $userID, ?array $search, ?array $display) { |
a56cad4
to
c557b05
Compare
ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php
Outdated
Show resolved
Hide resolved
@colemanw can I get you to take a look at this - it is a regression so we need to fix in the rc (currently 5.58). My issue is just where the values get typed along the way - it feels sloppy for the hook to have to handle it maybe being an array & maybe being null @mattwire can you change the branch? |
c13ab6b
to
879cc96
Compare
879cc96
to
52c3d2f
Compare
@colemanw @eileenmcnaughton what do you want to do with this one? |
52c3d2f
to
8625a27
Compare
Happy anniversary to this PR! 🎈 🎉 🥳 |
Overview
Update signature for searchKitTasks hook for civiimport