Skip to content

Search Kit - Links and Tasks

Most API entities provide a set of "paths" which SearchKit can use to display view/edit/delete links per row. For example, the Contact entity contains the following paths:

"add": "civicrm/contact/add?reset=1&ct=[contact_type]",
"view": "civicrm/contact/view?reset=1&cid=[id]",
"update": "civicrm/contact/add?reset=1&action=update&cid=[id]",
"delete": "civicrm/contact/view/delete?reset=1&delete=1&cid=[id]"
SearchKit treats anything within brackets like a token and replaces the value, e.g. [id] becomes the actual contact ID for each row.

Tasks

Legacy Search Tasks

For transitional purposes, SearchKit supports many of the tasks from Advanced Search, namely the ones that work in "standalone" mode (can be accessed via a url outside of the Advanced Search screen). To illustrate, here's a snippet from CRM_Contact_Task:

self::TASK_PRINT => [
  'title' => ts('Print selected rows'),
  'class' => 'CRM_Contact_Form_Task_Print',
  'result' => FALSE,
],
self::LABEL_CONTACTS => [
  'title' => ts('Mailing labels - print'),
  'class' => 'CRM_Contact_Form_Task_Label',
  'result' => TRUE,
  'url' => 'civicrm/task/make-mailing-label',
  'icon' => 'fa-print',
],
Notice that the first task does not contain a url key and therefore is not available in SearchKit, whereas the second task is accessible via a standalone url (and looks nice in the task list because of the icon).

Any task with a url property added via hook_civicrm_searchTasks will appear in SearchKit as well.

Angular-based Tasks

New tasks built for SearchKit consist of an Angular controller, which receives the name of the entity (e.g. "Contact") and an array of IDs to be acted upon. Typically this controller will present the user with a configuration form, and then run crmSearchBatchRunner which performs an api action on 500 records at a time & shows a progress bar to the user.

Extensions wishing to add new actions to SearchKit should implement hook_civicrm_searchKitTasks.