public function KanbanLogService::getRecentLogs in Content Planner 8
Get recent Logs.
Parameters
int $limit: The limit of the queried logs.
array $filter: An array containing filters if any.
Return value
\Drupal\content_kanban\Entity\KanbanLog[] Returns an array of Kanban logs.
File
- modules/
content_kanban/ src/ KanbanLogService.php, line 93
Class
- KanbanLogService
- Class KanbanLogService.
Namespace
Drupal\content_kanbanCode
public function getRecentLogs($limit = 10, array $filter = []) {
$query = $this->entityTypeManager
->getStorage('content_kanban_log')
->getQuery();
$query
->sort('created', 'DESC');
$query
->range(0, $limit);
if (isset($filter['exclude_anonymous_users']) && $filter['exclude_anonymous_users'] == TRUE) {
$query
->condition('user_id', 0, '<>');
}
$result = $query
->execute();
if ($result) {
return KanbanLog::loadMultiple($result);
}
return [];
}