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 +--------------------------------------------------------------------+
16 * Lists the most recently viewed entities by the current user.
18 * The list is stored in the user's session.
19 * The number of items stored is determined by the setting `recentItemsMaxCount`.
21 * @searchable secondary
25 class RecentItem
extends Generic\BasicEntity
{
27 protected static $idField = ['entity_id', 'entity_type'];
29 protected static $getter = ['CRM_Utils_Recent', 'get'];
30 protected static $setter = ['CRM_Utils_Recent', 'create'];
31 protected static $deleter = ['CRM_Utils_Recent', 'del'];
34 * @param bool $checkPermissions
35 * @return Generic\BasicGetFieldsAction
37 public static function getFields($checkPermissions = TRUE) {
38 return (new Generic\
BasicGetFieldsAction('RecentItem', __FUNCTION__
, function() {
41 'name' => 'entity_id',
42 'data_type' => 'Integer',
46 'name' => 'entity_type',
47 'title' => 'Entity Type',
48 'options' => \CRM_Utils_Recent
::getProviders(),
55 'name' => 'is_deleted',
56 'data_type' => 'Boolean',
63 'title' => 'View URL',
67 'title' => 'Edit URL',
70 'name' => 'delete_url',
71 'title' => 'Delete URL',
74 }))->setCheckPermissions($checkPermissions);
80 public static function permissions() {
82 'default' => ['access CiviCRM'],