public function OpignoNotificationController::getMessages in Opigno notifications 8
Same name and namespace in other branches
- 3.x src/Controller/OpignoNotificationController.php \Drupal\opigno_notification\Controller\OpignoNotificationController::getMessages()
Ajax callback. Get messages and its count.
1 string reference to 'OpignoNotificationController::getMessages'
File
- src/
Controller/ OpignoNotificationController.php, line 76
Class
- OpignoNotificationController
- Provides the controller for OpignoNotification entity pages.
Namespace
Drupal\opigno_notification\ControllerCode
public function getMessages() {
$uid = \Drupal::currentUser()
->id();
$renderer = \Drupal::service('renderer');
$variables = [];
$notifications_unread = views_embed_view('opigno_notifications', 'block_unread', $uid);
$private_messages = views_embed_view('private_message', 'block_last', $uid);
$variables['notifications_unread_count'] = OpignoNotification::unreadCount();
$variables['notifications_unread'] = $renderer
->render($notifications_unread);
$variables['private_messages'] = $renderer
->render($private_messages);
$variables['unread_thread_count'] = OpignoMessageThread::getUnreadThreadCount();
return new JsonResponse($variables);
}