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 +--------------------------------------------------------------------+
14 * Extensions - add-on modules extend the functionality of CiviCRM.
16 * @see https://docs.civicrm.org/user/en/latest/introduction/extensions/
17 * @searchable secondary
21 class Extension
extends Generic\AbstractEntity
{
24 * @param bool $checkPermissions
25 * @return Generic\BasicGetAction
27 public static function get($checkPermissions = TRUE) {
28 return (new Generic\
BasicGetAction(__CLASS__
, __FUNCTION__
, function($action) {
29 $statuses = \CRM_Extension_System
::singleton()->getManager()->getStatuses();
30 $mapper = \CRM_Extension_System
::singleton()->getMapper();
32 foreach ($statuses as $key => $status) {
34 $obj = $mapper->keyToInfo($key);
35 $info = \CRM_Extension_System
::createExtendedInfo($obj);
38 catch (\CRM_Extension_Exception
$ex) {
39 \Civi
::log()->error(sprintf('Failed to read extension (%1). Please refresh the extension list.', [1 => $key]));
43 }))->setCheckPermissions($checkPermissions);
47 * @param bool $checkPermissions
48 * @return Generic\BasicGetFieldsAction
50 public static function getFields($checkPermissions = TRUE) {
51 return (new Generic\
BasicGetFieldsAction(static::getEntityName(), __FUNCTION__
, function() {
55 'description' => 'Long, unique extension identifier',
59 'description' => 'Short, unique extension identifier',
63 'description' => 'User-facing extension title',
66 'name' => 'description',
67 'description' => 'Additional information about the extension',
71 'description' => 'Current version number (string)',
75 'data_type' => 'Array',
76 'description' => "Tags which characterize the extension's purpose or functionality",
80 'description' => 'Extension enabled/disabled/uninstalled status',
82 \CRM_Extension_Manager
::STATUS_UNINSTALLED
=> ts('Uninstalled'),
83 \CRM_Extension_Manager
::STATUS_DISABLED
=> ts('Disabled'),
84 \CRM_Extension_Manager
::STATUS_INSTALLED
=> ts('Enabled'),
85 \CRM_Extension_Manager
::STATUS_DISABLED_MISSING
=> ts('Disabled (Missing)'),
86 \CRM_Extension_Manager
::STATUS_INSTALLED_MISSING
=> ts('Enabled (Missing)'),
90 }))->setCheckPermissions($checkPermissions);
96 public static function getInfo() {
97 $info = parent
::getInfo();
98 $info['title'] = ts('Extension');
99 $info['title_plural'] = ts('Extensions');
100 $info['primary_key'] = ['key'];
101 $info['label_field'] = 'label';