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(),
27 'dateRanges' => \CRM_Utils_Array
::makeNonAssociative(\CRM_Core_OptionGroup
::values('relative_date_filters'), 'id', 'text'),
34 public static function getGroupOptions():array {
35 return \Civi\Api4\Group
::getFields(FALSE)
36 ->setLoadOptions(['id', 'label'])
37 ->addWhere('name', 'IN', ['group_type', 'visibility'])
46 public static function getTasks():array {
47 // Note: the placeholder %1 will be replaced with entity name on the clientside
50 'title' => ts('Export %1'),
51 'icon' => 'fa-file-excel-o',
52 'entities' => array_keys(\CRM_Export_BAO_Export
::getComponents()),
54 'path' => "'civicrm/export/standalone'",
55 'query' => "{entity: entity, id: ids.join(',')}",
59 'title' => ts('Update %1'),
62 'uiDialog' => ['templateUrl' => '~/crmSearchActions/crmSearchActionUpdate.html'],
65 'title' => ts('Delete %1'),
68 'uiDialog' => ['templateUrl' => '~/crmSearchActions/crmSearchActionDelete.html'],
72 // Add contact tasks which support standalone mode (with a 'url' property)
73 $contactTasks = \CRM_Contact_Task
::permissionedTaskTitles(\CRM_Core_Permission
::getPermission());
74 foreach (\CRM_Contact_Task
::tasks() as $id => $task) {
75 if (isset($contactTasks[$id]) && !empty($task['url']) && $task['url'] !== 'civicrm/task/delete-contact') {
76 $tasks['contact.' . $id] = [
77 'title' => $task['title'],
78 'entities' => ['Contact'],
79 'icon' => $task['icon'] ??
'fa-gear',
81 'path' => "'{$task['url']}'",
82 'query' => "{cids: ids.join(',')}",