SearchKit - non-core legacy search tasks don't work with contributions
Reproduction steps
- Create a SearchKit with contribution entities
- Enable an extension with a legacy search task (e.g. https://lab.civicrm.org/ufundo/ukgiftaid/-/tree/searchkit-actions )
- Task appears in the ACTIONS menu for the contributions
- But the popup when you click the action fails ( "Unable to reach the server. Please refresh this page in your browser and try again.")
Current behaviour
We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.<br /><br />Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.<br /><br />Error type: Could not find a valid session key.
Expected behaviour
Action form should appear in the pop up.
Comments
SearchDisplay::getSearchTasks
currently generates qfKey for legacy search task forms based on hard-coded class CRM_Contribute_Controller_Task
in this line https://github.com/civicrm/civicrm-core/blob/a599e40ad27ebcd9d4b8e80bf0a5904983d5ee82/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php#LL196C1-L196C77
This causes tasks using any other class controller fail due to the mismatch.
Couple of potential fixes incoming...