namespace Civi\Api4\Action\SearchDisplay;
+use Civi\Api4\Generic\Traits\SavedSearchInspectorTrait;
use CRM_Search_ExtensionUtil as E;
use Civi\Api4\Entity;
*/
class GetSearchTasks extends \Civi\Api4\Generic\AbstractAction {
+ use SavedSearchInspectorTrait;
+
+ /**
+ * An array containing the searchDisplay definition
+ * @var array
+ */
+ protected $display;
+
/**
* Name of entity
* @var string
if (!$entity) {
return;
}
+
+ $this->loadSavedSearch();
+ $this->loadSearchDisplay();
+
$tasks = [$entity['name'] => []];
if (array_key_exists($entity['name'], \CRM_Export_BAO_Export::getComponents())) {
$null = NULL;
$checkPermissions = $this->checkPermissions;
$userId = $this->checkPermissions ? \CRM_Core_Session::getLoggedInContactID() : NULL;
- \CRM_Utils_Hook::singleton()->invoke(['tasks', 'checkPermissions', 'userId'],
+ \CRM_Utils_Hook::singleton()->invoke(['tasks', 'checkPermissions', 'userId', 'search', 'display'],
$tasks, $checkPermissions, $userId,
- $null, $null, $null, 'civicrm_searchKitTasks'
+ $this->savedSearch, $this->display, $null, 'civicrm_searchKitTasks'
);
foreach ($tasks[$entity['name']] as $name => &$task) {
initialized = true;
crmApi4({
entityInfo: ['Entity', 'get', {select: ['name', 'title', 'title_plural', 'primary_key'], where: [['name', '=', ctrl.entity]]}, 0],
- tasks: ['SearchDisplay', 'getSearchTasks', {entity: ctrl.entity}]
+ tasks: ['SearchDisplay', 'getSearchTasks', {entity: ctrl.entity, savedSearch: ctrl.search, display: ctrl.display}]
}).then(function(result) {
ctrl.entityInfo = result.entityInfo;
ctrl.tasks = result.tasks;
$tasks = [];
$null = NULL;
$checkPermissions = FALSE;
- \CRM_Utils_Hook::singleton()->invoke(['tasks', 'checkPermissions', 'userId'],
+ \CRM_Utils_Hook::singleton()->invoke(['tasks', 'checkPermissions', 'userId', 'search', 'display'],
$tasks, $checkPermissions, $null,
$null, $null, $null, 'civicrm_searchKitTasks'
);