3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
12 namespace Civi\Search
;
16 * @package Civi\Search
23 public static function getActionSettings():array {
25 'tasks' => self
::getTasks(),
26 'groupOptions' => self
::getGroupOptions(),
33 public static function getGroupOptions():array {
34 return \Civi\Api4\Group
::getFields(FALSE)
35 ->setLoadOptions(['id', 'label'])
36 ->addWhere('name', 'IN', ['group_type', 'visibility'])
45 public static function getTasks():array {
46 // Note: the placeholder %1 will be replaced with entity name on the clientside
49 'title' => ts('Export %1'),
50 'icon' => 'fa-file-excel-o',
51 'entities' => array_keys(\CRM_Export_BAO_Export
::getComponents()),
53 'path' => "'civicrm/export/standalone'",
54 'query' => "{entity: entity, id: ids.join(',')}",
58 'title' => ts('Update %1'),
61 'uiDialog' => ['templateUrl' => '~/searchActions/crmSearchActionUpdate.html'],
64 'title' => ts('Delete %1'),
67 'uiDialog' => ['templateUrl' => '~/searchActions/crmSearchActionDelete.html'],
71 // Add contact tasks which support standalone mode (with a 'url' property)
72 $contactTasks = \CRM_Contact_Task
::permissionedTaskTitles(\CRM_Core_Permission
::getPermission());
73 foreach (\CRM_Contact_Task
::tasks() as $id => $task) {
74 if (isset($contactTasks[$id]) && !empty($task['url']) && $task['url'] !== 'civicrm/task/delete-contact') {
75 $tasks['contact.' . $id] = [
76 'title' => $task['title'],
77 'entities' => ['Contact'],
78 'icon' => $task['icon'] ??
'fa-gear',
80 'path' => "'{$task['url']}'",
81 'query' => "{cids: ids.join(',')}",